Stap 5: Arduino code
Deze chronometer tijd weergeven in de indeling uren: minuten: seconden: milliseconden
Hieronder is de code die u wilt "controleren" in de Arduino 1.6.6 en uploaden in de simulatie van de arduino
#include
Const byte interruptPin2 = 2;
Const byte interruptPin3 = 3;
int status;
int count;
int eerste;
int minuut;
int seconden;
int uur;
LiquidCrystal lcd(12,11,7,6,5,4);
VOID Setup {}
pinMode(interruptPin2,INPUT_PULLUP);
pinMode(interruptPin3,INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(interruptPin2), start, vallen);
attachInterrupt(digitalPinToInterrupt(interruptPin3), stop1, vallen);
de LCD's aantal kolommen en rijen instellen:
LCD.begin (16, 2);
lcd.setCursor(1,0);
LCD.Print ("tijd verstreken:");
lcd.setCursor(3,1);
LCD.Print(":");
lcd.setCursor(7,1);
LCD.Print(":");
lcd.setCursor(11,1);
LCD.Print(":");
}
void loop {}
Initial=Millis();
seconden = 0; minute = 0; uren = 0;
while(State) {}
Count=(int)((Millis()-Initial));
if(Count>999) {}
eerste += 1000;
seconden ++;
if(seconds>59) {}
seconden = 00;
lcd.setCursor(9,1);
LCD.Print("");
minuut ++;
if(Minute>59) {}
minuten = 0;
lcd.setCursor(5,1);
LCD.Print("");
uren ++;
}
}
}
lcd.setCursor(0,1);
LCD.Print(hours);
lcd.setCursor(4,1);
LCD.Print(Minute);
lcd.setCursor(8,1);
LCD.Print(seconds);
lcd.setCursor(12,1);
LCD.Print(Count);
}}
VOID start() {}
staat = 1;
}
ongeldig stop1() {}
staat = 0;
}