Buttons
This commit is contained in:
parent
cbbc9154db
commit
75e6413693
|
|
@ -107,6 +107,14 @@ Previous -> 16 and GND
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
|
## Schematic without modules
|
||||||
|
### Charging circuit
|
||||||
|
https://ww1.microchip.com/downloads/en/AppNotes/01149c.pdf
|
||||||
|
MCP73837 ?
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Links
|
## Links
|
||||||
|
|
||||||
https://github.com/earlephilhower/ESP8266Audio
|
https://github.com/earlephilhower/ESP8266Audio
|
||||||
|
|
|
||||||
20
src/main.cpp
20
src/main.cpp
|
|
@ -62,6 +62,8 @@ bool asyncStop = false;
|
||||||
|
|
||||||
bool asyncStart = false;
|
bool asyncStart = false;
|
||||||
|
|
||||||
|
bool asyncTogglePlayPause = false;
|
||||||
|
|
||||||
std::map<String, String> rfid_map{{"67 152 204 14", "01-The_Box_Tops-The_Letter.mp3"},
|
std::map<String, String> rfid_map{{"67 152 204 14", "01-The_Box_Tops-The_Letter.mp3"},
|
||||||
{"67 175 148 160","068-Der_Schatz_im_Bergsee"}};
|
{"67 175 148 160","068-Der_Schatz_im_Bergsee"}};
|
||||||
|
|
||||||
|
|
@ -431,6 +433,11 @@ void loop()
|
||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (asyncTogglePlayPause) {
|
||||||
|
asyncTogglePlayPause = false;
|
||||||
|
togglePlayPause();
|
||||||
|
}
|
||||||
|
|
||||||
rfid_loop--;
|
rfid_loop--;
|
||||||
|
|
||||||
if (rfid_loop == 0)
|
if (rfid_loop == 0)
|
||||||
|
|
@ -448,20 +455,12 @@ void loop()
|
||||||
|
|
||||||
void loop2(void *parameter)
|
void loop2(void *parameter)
|
||||||
{
|
{
|
||||||
|
Serial.println("loop2 started");
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if (buttonPressed(BTN_START_STOP))
|
if (buttonPressed(BTN_START_STOP))
|
||||||
{
|
{
|
||||||
if (audio.isRunning())
|
asyncTogglePlayPause = true;
|
||||||
{
|
|
||||||
asyncStop = true;
|
|
||||||
asyncStart = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
asyncStart = true;
|
|
||||||
asyncStop = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -473,7 +472,6 @@ boolean buttonPressed(const uint8_t pin)
|
||||||
unsigned long now = millis();
|
unsigned long now = millis();
|
||||||
if (now - lastStart > startDelay)
|
if (now - lastStart > startDelay)
|
||||||
{
|
{
|
||||||
|
|
||||||
lastStart = now;
|
lastStart = now;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue