LoginSignup
0
0

More than 5 years have passed since last update.

Arduino LEONARDOでLM335Zの温度センサーをつなぐ

Last updated at Posted at 2016-05-26
int val = 0;
float v = 5;

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

void loop() {
  val = analogRead(A0);
  float temp = modTemp(val);
  Serial.println(temp);
  delay(1000);
}

float modTemp(int analog_val){
  float v = 5;
  float tempC = (v * analog_val)  * 100 / 1024.0 -273.15 ;
  return tempC;
}

抵抗は2KΩ

S__40550407.jpg

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