int motor = 9; //Set motor pin to pin 9 on arduino int led = 13; //Set led pin to pin 13 on arduino #define TouchSensor 3 //Set Touch sensor to pin 3 on arduino void setup() { pinMode(motor,OUTPUT); //Set motor as an output pinMode(led,OUTPUT); //Set led as an Output pinMode(TouchSensor,INPUT); //Set touch sensor as input } void loop() { int sensorValue = digitalRead(TouchSensor); //tell the arduino to digitally read the touch sensor value if(sensorValue){ //set an if statement so the arduino can tell when its on and off digitalWrite(led,LOW); //when the sensor is not touched the led will stay off digitalWrite(motor,LOW); //when the sensor is not touched the motor will stay off while(digitalRead(TouchSensor) == HIGH); // set a while statement so if the sensor is touched the led and motor turn on digitalWrite(led,HIGH); //turn on led digitalWrite(motor,HIGH); //turn on motor } }