Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/http connection #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions src/main/main.ino
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ char* filePositiveARMarker = "/filePositiveARMarker.jpg";
char* filePositiveMP3 = "/filePositiveMP3.mp3";
char* fileNegativeARMarker = "/fileNegativeARMarker.jpg";
char* fileNegativeMP3 = "/fileNegativeMP3.mp3";
char* fileDefault = "/fileDefault.jpg";

/* Plays MP3 */
void playMP3(char *filename){
Expand All @@ -36,10 +37,10 @@ void playMP3(char *filename){
mp3->begin(id3, out);
}

/* Draws 200x200 JPG file */
/* Draws 240x240 JPG file */
void drawARMarker(char *filename) {
uint16_t x = 60;
uint16_t y = 20;
uint16_t x = 40;
uint16_t y = 0;

M5.Lcd.fillScreen(TFT_BLACK);
M5.Lcd.drawJpgFile(SD, filename, x, y);
Expand All @@ -65,14 +66,17 @@ void handleStatus() {

if (postdata == "positive"){
drawARMarker(filePositiveARMarker);
mp3->stop();
playMP3(filePositiveMP3);
server.send(200, "text/plain", "Positive audio start");
} else if (postdata == "negative"){
drawARMarker(fileNegativeARMarker);
mp3->stop();
delay(10000);
playMP3(fileNegativeMP3);
server.send(200, "text/plain", "Cheering audio start");
} else if (postdata == "off"){
M5.Lcd.fillScreen(TFT_BLACK);
drawARMarker(fileDefault);
mp3->stop();
server.send(200, "text/plain", "audio end");
}
Expand Down Expand Up @@ -134,8 +138,9 @@ void setup(){

// LCD display
M5.Lcd.setTextSize(3);
M5.Lcd.println("Waiting");

drawARMarker(fileDefault);
Serial.println("Waiting");

playMP3(filePositiveMP3);
mp3->stop();
}
Expand Down