Hardware components | ||||||
| × | 1 | ||||
| × | 1 | ||||
| × | 1 | ||||
| × | 1 |
int ledpin=8;
int threshold_value=400;
void setup() {
Serial.begin(9600);
pinMode(ledpin,OUTPUT);
pinMode(buttonpin,OUTPUT);
// put your setup code here, to run once:
}
void loop() {
int sensorvalue=analogRead(A0);
Serial.println(sensorvalue);
if(sensorvalue>threshold_value)
digitalWrite(ledpin,HIGH);
delay(200);
digitalWrite(ledpin,LOW);
}
// put your main code here, to run repeatedly:
Comments