よく訓練されたアップル信者、都元です。昨日のエントリーはこちらです。昨日はmraaライブラリを使ってセンサの値を取得しましたが、取れる値がプリミティブでした。要するにread()で取れる値というのは、AREF(特に繋いでいないので5V)を1024として何Vの電圧がピンに掛かっていたのかを取り出しただけです。 これを温度に変換するためによくわからない計算をしましたが、「温度センサーなんだからそもそも摂氏で値が取れればいいじゃん」という、より高水準なAPIも提供されています。 upm このようなライブラリがupmです。upmは下記のように *1様々なセンサーをサポートしています。 それぞれ、センサーのチップ名で呼ばれているようで、何だか分かりにくいですが、ググればそれぞれ出てきます。ここでは前回も利用した構成でupm::GroveTempとupm::GroveLightを使ってみましょう。ちな