Arduino Code for Flashing Rider’s Glove

by Vernelle Noel

int sensorPin = A5;
int sensorValue;
int internalLED = 13;
int LED1 = 5;
int LED2 = 6;
int LED3 = 9;
int LED4 = 10;

void setup() {
pinMode(sensorPin, INPUT);
digitalWrite(sensorPin, HIGH); //turns on the internal pull-up resistor

pinMode(internalLED, OUTPUT);
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
pinMode(LED3, OUTPUT);
pinMode(LED4, OUTPUT);

digitalWrite(internalLED, HIGH);
Serial.begin(9600);
}

void loop() {
sensorValue = analogRead(sensorPin);
Serial.println(sensorValue);
delay(100);

if (sensorValue < 30)
{
digitalWrite(LED1, HIGH); // set the LED on
digitalWrite(LED2, HIGH); // set the LED on
digitalWrite(LED3, HIGH); // set the LED on
digitalWrite(LED4, HIGH); // set the LED on
delay(400);              // wait for 400th of a second
digitalWrite(LED1, LOW);    // set the LED off
digitalWrite(LED2, LOW);    // set the LED off
digitalWrite(LED3, LOW);    // set the LED off
digitalWrite(LED4, LOW);    // set the LED off
delay(400);              // wait for 400th of a second
}
}