i am intrested in making brobot whch will hav pir sensor when the pir sensor goes high it should stop else it must go through a desired path... here is the code but it is not working pls help me ot
int motor_1_terminal_1 = 5; int motor_1_terminal_2 = 6; int motor_2_terminal_1 = 10; int motor_2_terminal_2 = 11; int ir=2; void setup() { Serial.begin(9600); pinMode(motor_1_terminal_1, OUTPUT); pinMode(motor_1_terminal_2, OUTPUT); pinMode(motor_2_terminal_1, OUTPUT); pinMode(motor_2_terminal_2, OUTPUT); attachInterrupt(2,stopmotor,RISING); } void stopmotor() { analogWrite(motor_1_terminal_1,0); analogWrite(motor_1_terminal_2,0); analogWrite(motor_2_terminal_1,0); analogWrite(motor_2_terminal_2,0); } void loop() { analogWrite(motor_1_terminal_1,255); analogWrite(motor_1_terminal_2,0); analogWrite(motor_2_terminal_1,255); analogWrite(motor_2_terminal_2,0); }