Professional Documents
Culture Documents
void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the Start Switch pin as an input:
pinMode(switchPin, INPUT);
}
void loop() {
// read the state of the Start Switch value:
switchState = digitalRead(switchPin);
//Program for virtual counter, if Hspeed or Lspeed fungtion HIGH, counter will
start counting
//if Hspeed is true, start counting. counter will increase 1 per 0.5 sec
if (ledPin7 == HIGH &&
ledPin11 == HIGH &&
ledPin9 == HIGH &&
ledPin5 == HIGH) {
counter=counter+1;
delay(500);
}
//if Lspeed is true start counting. counter will increase 1 per 1 sec.
else if (ledPin7 == HIGH &&
ledPin11 == HIGH &&
ledPin9 == HIGH &&
ledPin5 == HIGH) {
counter=counter+1;
delay(1000);
}