int IRSensor = 2; // connect ir sensor to arduino pin 2 int LED = 8; // conect Led to arduino pin 8 int Vibration_motor = 10; // conect Vibration motor to arduino pin 10 #include SoftwareSerial mySerial(1, 0); // RX, TX void setup() { mySerial.begin(9600); pinMode (IRSensor, INPUT); // sensor pin INPUT pinMode (LED, OUTPUT); // Led pin OUTPUT pinMode (Vibration_motor, OUTPUT); // Led pin OUTPUT } void loop() { int statusSensor = digitalRead (IRSensor); if (statusSensor == 1){ digitalWrite(LED, LOW); // LED LOW digitalWrite(Vibration_motor, LOW); // LED LOW mySerial.println("nothing detected"); } else { digitalWrite(LED, HIGH); // LED High digitalWrite(Vibration_motor, HIGH); // LED High mySerial.println("detected!!!!!"); } }