Sonu works as an office boy in the school of Jugaadu. Sonu works hard and finishes tasks with good efficiency. One of his work is to clean the teachers' desk. The task is to collect dust and wipe the table with the wet cloth. The complete process takes too much of his time, he wants to work in the Tinkering lab in free time. He asked Jugaadu to make a device for him to solve this issue. Can you tell us how?
Bag Items:
"
#include
Servo s;
int ir=12;
void setup() {
pinMode(13,OUTPUT);
pinMode(ir,INPUT);
s.attach(11);
digitalWrite(13,HIGH);
}
void loop() {
if(!digitalRead(ir)){
for(int i=0; i<90; i++){
s.write(i);
delay(1);
}
delay(500);
for(int j=90; j>1; j--){
s.write(j);
delay(1);
}
}else{
s.write(0);
}
}