« micro:bit (3) Arduino IDE による開発環境ができた | トップページ | micro:bit (5) スクロール時計 »

2020年5月 7日 (木)

micro:bit (4) 温度計 

 micro:bit のダイ温度をLEDマトリクスでスクロール表示してみました。
sd_temp_get()の戻り値がセ氏温度の4倍なので,4で割ってから表示します。

//micro:bit 温度計

#include <Adafruit_Microbit.h>
Adafruit_Microbit_Matrix microbit;
BLEPeripheral blePeripheral = BLEPeripheral();
int32_t temp;

void setup() {
  Serial.begin(9600);
  blePeripheral.begin();
  microbit.begin();
}

void loop() {
  sd_temp_get(&temp);
  microbit.print(temp/4);
  microbit.print("C ");
  Serial.println(temp/4);
  delay(100);
}

| |

« micro:bit (3) Arduino IDE による開発環境ができた | トップページ | micro:bit (5) スクロール時計 »

Arduino」カテゴリの記事

micro:bit」カテゴリの記事

コメント

コメントを書く



(ウェブ上には掲載しません)


コメントは記事投稿者が公開するまで表示されません。



« micro:bit (3) Arduino IDE による開発環境ができた | トップページ | micro:bit (5) スクロール時計 »