this is my first attempt at coding in arduino and before i have an arduino to test it would anybod be able to tell me if this would work?
an led with 220ohm resistor on pin 13 and an LM35 temperature sensor on analog pin 0. if themp falls below 40 deg then the led should turn off.
int led = 13;
void setup() {
Serial.begin(9600);
pinMode(led, OUTPUT);
}
void loop() {
int sensorValue = analogRead(A0);
Serial.println(sensorValue, DEC)
if sensorValue > 40 {
digitalWrite(led, HIGH);
}
if sensorValue < 40 {
digitalWrite(led, LOW );
}
}
thanks in advance
an led with 220ohm resistor on pin 13 and an LM35 temperature sensor on analog pin 0. if themp falls below 40 deg then the led should turn off.
int led = 13;
void setup() {
Serial.begin(9600);
pinMode(led, OUTPUT);
}
void loop() {
int sensorValue = analogRead(A0);
Serial.println(sensorValue, DEC)
if sensorValue > 40 {
digitalWrite(led, HIGH);
}
if sensorValue < 40 {
digitalWrite(led, LOW );
}
}
thanks in advance
