99 lines
1.7 KiB
C++
99 lines
1.7 KiB
C++
#include "main.h"
|
|
|
|
//funtion prototypes
|
|
void show_counters(uint64_t counter_licht, uint64_t counter_move);
|
|
|
|
//variables
|
|
uint64_t licht_all_count = 0;
|
|
uint64_t move_all_count = 0;
|
|
|
|
void setup() {
|
|
//load counters
|
|
save.set_int("licht", 0);
|
|
save.set_int("move", 0);
|
|
licht_all_count = save.get_int("licht");
|
|
move_all_count = save.get_int("move");
|
|
// all relais off;
|
|
haeuser.off();
|
|
sterne.off();
|
|
spiegel.off();
|
|
other.off();
|
|
zugoben.stop();
|
|
zugunten.stop();
|
|
|
|
led_tanne.setColor(0x0f0);
|
|
mp3ply.play(1);
|
|
|
|
}
|
|
|
|
uint8_t licht_count = 0;
|
|
|
|
void loop() {
|
|
|
|
led_teich.rainbowCycle();
|
|
rgb_leds.show();
|
|
|
|
if(taster_aussen_licht.pressed())
|
|
{
|
|
licht_all_count++;
|
|
save.set_int("licht",licht_all_count);
|
|
licht_count++;
|
|
if(licht_count > 4)
|
|
licht_count = 1;
|
|
}
|
|
|
|
if(taster_aussen_move.pressed())
|
|
{
|
|
move_all_count++;
|
|
save.set_int("move", move_all_count);
|
|
}
|
|
|
|
show_counters(licht_all_count, move_all_count);
|
|
|
|
switch (licht_count)
|
|
{
|
|
case 1:
|
|
haeuser.on();
|
|
sterne.off();
|
|
spiegel.off();
|
|
other.off();
|
|
break;
|
|
case 2:
|
|
haeuser.off();
|
|
sterne.on();
|
|
spiegel.off();
|
|
other.off();
|
|
break;
|
|
case 3:
|
|
haeuser.off();
|
|
sterne.off();
|
|
spiegel.on();
|
|
other.off();
|
|
break;
|
|
case 4:
|
|
haeuser.off();
|
|
sterne.off();
|
|
spiegel.off();
|
|
other.on();
|
|
break;
|
|
default:
|
|
haeuser.off();
|
|
sterne.off();
|
|
spiegel.off();
|
|
other.off();
|
|
break;
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
void show_counters(uint64_t counter_licht, uint64_t counter_move)
|
|
{
|
|
moni.clear();
|
|
moni.header("Zaehler");
|
|
moni.data(10,15,counter_licht, "Licht:");
|
|
moni.data(10,15,counter_move, "Moves:");
|
|
moni.show();
|
|
} |