/* TurnOn LED Written June 19, 2020 by R Jordan Keindler Uses an Arduino UNO */ int IRModulePinNumber = 7; // Set the OUT pin for the IR Obstacle Avoidance Module // as header 7 on a UNO int LED1 = 8; // Set the LED to digital pin 8 on a UNO int val; // Make val an integer void setup() { pinMode(IRModulePinNumber, INPUT); // Set the IR Obstacle Avoidance Module for input pinMode(LED1, OUTPUT); // Set the LED for output } void loop() { val = digitalRead(IRModulePinNumber); // Read the IR Collision Avoidance OUT pin if (val == 0) // If an obstacle is near, perform the if loop { digitalWrite(LED1, HIGH); // Set the LED On } digitalWrite(LED1, LOW); // Turn the LED Off }