Hi,
ich will einen weiteren Taster für "timeset - 1" nutzen, bin aber
unsicher, wie man das am besten löst, wie es funktonieren kann ist mir
klar, aber eben nicht, obs dann so ordentlich ist, würde den gesammten
digitalRead-Prozess einfach kopieren, den Taster-Pin ändern und aus dem
+ ein - machen. Denke das müsste irgendwie mit nem else kürzer gehen,
komm aber nicht dahinter wie. Hoffe ihr könnt mir da mal eben helfen.
Mfg
1 | case 1: //Hour setting
|
2 | if (flash) {
|
3 | display.drawRect(15, 0, 13, 9, BLACK); //Flash cursor (5Hz)
|
4 | }
|
5 | if (!digitalRead(8) && (!flash)) { //Update setting at 5Hz rate if button held down
|
6 | timeset = t.hour; //Get the current hour and save in temporary variable
|
7 | timeset = timeset + 1; //Increment the hour at 5Hz rate
|
8 | if (timeset > 23) {
|
9 | timeset = 0; //Roll over hour after 23rd hour (setting done in 24-hour mode)
|
10 | }
|
11 | t.hour = timeset; //After each update, write the hour to the time structure
|
12 | set_rtc_field(t, hourset); //Write the set field only to the RTC after each update
|
13 | }
|
14 | break;
|