Develop script to test sensors (IR sensor)
Develop script to test sensors (IR sensor) - TinkerCad
Tinker Cad circuit design:
Components Required:
1) Arduino Uno R3
2) PIR Sensor
3) Piezo (Buzzer)
4) LED RGB
Code for above circuit:
int pirsesnor = 0;
void setup(){
pinMode(2, INPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
}
void loop(){
pirsesnor = digitalRead(2);
if(pirsesnor == HIGH){
digitalWrite(13, HIGH);
tone(12,500,500);
}
digitalWrite(13, LOW);
}
Comments
Post a Comment