LoginSignup
0
0

More than 3 years have passed since last update.

raspberrypiとESP32を使った自分でIoTプラットホーム作成(その3)~ESP32設定編アナログ温度センサー

Posted at

前回でESP32とArduinoの接続が問題なかったので、温度センサーを接続してそれをシリアルで読み取ります。
センサーは手元にあったLM35DZ-Nという製品です。
温度の換算は別として無事、Arduino-IDEでモニタリングすることができました。

次はBuletoothを使ってRaspberryPiとESP32リンクさせます。
これはやったことがないので大きな難関です(やり方はQiitaやWebにたくさん記載ありますが)。

#define LM35DZN 25
void setup(){
    Serial.begin(115200);
    while(!Serial);
    pinMode(LM35DZN,INPUT);
}
void loop(){
  int e=analogRead(LM35DZN);

  float Vout = e/4095.0*3.3+0.1132;
  float temp =(Vout -0.6)/0.01;
  Serial.println(temp);
  delay(1000);
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0