added another new song

This commit is contained in:
Jens Noack 2021-12-21 14:27:56 +01:00
parent a3aa425379
commit 18bb01de72
3 changed files with 30 additions and 9 deletions

View File

@ -380,7 +380,7 @@ void leds::blueCycle()
for(size_t nr = _blue_color; nr< _pixel_nr; nr = nr+3) {
if(_blue_pixel >= 3)
_blue_pixel = 0;
uint32_t color = _stripe->ColorHSV(38000,255, 2 + _blue_pixel*5);
uint32_t color = _stripe->ColorHSV(43690,255, 1 + _blue_pixel*10);
//Serial.printf(" blue_color is %d, cnt is %d , color is %d, pixel is %d\n", _blue_color, _blue_pixel, color, nr);
_pixels[nr].color = color;
_blue_pixel++;

View File

@ -30,6 +30,13 @@ const uint8_t SONG_OH_TANNEBAUM = 7;
const uint8_t SONG_DISCO_MARYSBOYCHILD = 9;
const uint8_t SONG_DISCO_LASTCHRISTMAS = 11;
const uint8_t SONG_DISCO_DOTHEYKNOWITSCHRISTMAS = 13;
const uint8_t SONG_WEIHNACHTSZEIT = 15;
const uint8_t SONG_ZEIT_ANGEKOMMEN = 17;
const uint8_t SONG_WINTER = 19;
const uint8_t SONG_WEIHNACHTSTRAUM = 21;
const uint8_t SONG_DISCO_MERRY_CHRISTMAS = 23;
//const uint8_t SONG_DISCO_ = ;
//const uint8_t SONG_DISCO_ = ;
mp3 mp3ply(PIN_MP3_RX, PIN_MP3_TX);
@ -39,8 +46,10 @@ const size_t PIN_RELAIS_0 = 5;
const size_t PIN_RELAIS_1 = 17;
const size_t PIN_RELAIS_2 = 16;
const size_t PIN_RELAIS_3 = 4;
const size_t PIN_IO2 = 9; //relais Wolke
relais relais_wolke_schiene(PIN_RELAIS_2);
relais relais_spiegel(PIN_RELAIS_3);
//relais relais_wolke(PIN_IO2);
///---- Spannungsregler
uint32_t spannungsregler_state_flag = 0;
@ -55,9 +64,9 @@ train zugoben("Zugoben", PIN_TRAIN_OBEN, PWM_CHANNEL_OBEN, PIN_RELAIS_0,5 );
train licht("Licht", PIN_LICHT, PWM_CHANNEL_LICHT, -1 ,5);
///--- IOs ----
const size_t PIN_IO0 = 23;
const size_t PIN_IO1 = 10;
const size_t PIN_IO2 = 9;
const size_t PIN_IO0 = 23; //Schiene oben
const size_t PIN_IO1 = 10;
const size_t PIN_IO3 = 18;
///--- Taster ----
@ -68,9 +77,9 @@ const size_t PIN_TASTER_TRAIN_UNTEN = 35;
const size_t PIN_TASTER_TRAIN_OBEN = 13;
taster taster_aussen_licht(PIN_TASTER_AUSSEN_LICHT);
taster taster_aussen_move(PIN_TASTER_AUSSEN_MOVE);
taster taster_train_unten(PIN_TASTER_TRAIN_UNTEN);
taster taster_train_oben(PIN_TASTER_TRAIN_OBEN);
taster taster_schiene(PIN_IO0);
//taster taster_train_unten(PIN_TASTER_TRAIN_UNTEN);
//taster taster_train_oben(PIN_TASTER_TRAIN_OBEN);
//taster taster_schiene(PIN_IO0);
///--- RGB LEDs ---
uint32_t licht_state_flag = 0;

View File

@ -6,7 +6,7 @@
class taster
{
private:
volatile const unsigned long _BOUNCING_TIME_MS = 300;
volatile const unsigned long _BOUNCING_TIME_MS = 200;
volatile unsigned long _last_pressed;
unsigned long _number_pressed;
unsigned long _number_checked;
@ -45,7 +45,7 @@ taster::taster(size_t pin)
void taster::begin()
{
pinMode(_taster_pin, INPUT_PULLUP);
attachInterrupt(_taster_pin, std::bind(&taster::_taster_int,this), FALLING);
//attachInterrupt(_taster_pin, std::bind(&taster::_taster_int,this), FALLING);
//attachInterrupt(_taster_pin, isrfunction, FALLING);
}
@ -55,6 +55,17 @@ taster::~taster()
}
bool taster::pressed() {
unsigned long msecs = millis();
if(msecs -_last_pressed > _BOUNCING_TIME_MS)
{
_last_pressed = msecs;
if(digitalRead(_taster_pin) == LOW)
return(true);
else
return false;
}
return false;
/*
//if (*_ptr_number_pressed > _number_checked)
if (_number_pressed > _number_checked)
{
@ -63,6 +74,7 @@ bool taster::pressed() {
return true;
}
return false;
*/
}
void taster::reset() {