|
@ -22,23 +22,17 @@ |
|
|
|
|
|
|
|
|
// Define some colors to match individual emotions
|
|
|
// Define some colors to match individual emotions
|
|
|
const uint16_t emotionColors[] = { |
|
|
const uint16_t emotionColors[] = { |
|
|
0xFFE0, // HAPPY = YELLOW
|
|
|
0xF800, // HAPPY = YELLOW
|
|
|
0x07E0, // SAD = BLUE
|
|
|
0xFFFF, // SAD = BLUE
|
|
|
0xF800, // ANGRY = RED
|
|
|
0x07E0, // ANGRY = RED
|
|
|
0xFA60, // FEAR = ORANGE
|
|
|
0xFA60 // NEUTRAL = WHITE
|
|
|
0xF8FF, // SURPRISED = PURPLE
|
|
|
|
|
|
0x07E0, // DISGUST = GREEN
|
|
|
|
|
|
0xFFFF // NEUTRAL = WHITE
|
|
|
|
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
enum Emotion { |
|
|
enum Emotion { |
|
|
HAPPY, |
|
|
HAPPY = 0, |
|
|
SAD, |
|
|
SAD = 1, |
|
|
ANGRY, |
|
|
ANGRY = 2, |
|
|
FEAR, |
|
|
NEUTRAL = 3 |
|
|
SURPRISED, |
|
|
|
|
|
DISGUST, |
|
|
|
|
|
NEUTRAL |
|
|
|
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
int past_prc_reading = 0; |
|
|
int past_prc_reading = 0; |
|
@ -47,7 +41,7 @@ float pot_data = 0; |
|
|
Emotion emote; |
|
|
Emotion emote; |
|
|
int screen_width, screen_height; |
|
|
int screen_width, screen_height; |
|
|
// pass for beta: n->stubborn_vectors p->sv-beta24, and change IP address to server!
|
|
|
// pass for beta: n->stubborn_vectors p->sv-beta24, and change IP address to server!
|
|
|
TCP tcp("VM9093853", "kfrzuk8UngxyytUz", "192.168.0.169", 12345); |
|
|
TCP tcp("stubborn_vectors", "sv-beta24", "192.168.0.3", 6762); |
|
|
TFT_eSPI tft = TFT_eSPI(); |
|
|
TFT_eSPI tft = TFT_eSPI(); |
|
|
|
|
|
|
|
|
void setupWiFi(){ |
|
|
void setupWiFi(){ |
|
@ -71,6 +65,7 @@ void drawText(String& emotionText, int& i){ |
|
|
tft.drawCentreString(ps, screen_width / 2, screen_height - (screen_height / 6), 1); |
|
|
tft.drawCentreString(ps, screen_width / 2, screen_height - (screen_height / 6), 1); |
|
|
int emotionIndex = static_cast<int>(emote); |
|
|
int emotionIndex = static_cast<int>(emote); |
|
|
tcp.sendData(dec_val, emotionIndex); |
|
|
tcp.sendData(dec_val, emotionIndex); |
|
|
|
|
|
Serial.println(emotionIndex); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void setupEmotion(String& emotionText){ |
|
|
void setupEmotion(String& emotionText){ |
|
@ -78,9 +73,6 @@ void setupEmotion(String& emotionText){ |
|
|
case HAPPY: emotionText = "HAPPY"; break; |
|
|
case HAPPY: emotionText = "HAPPY"; break; |
|
|
case SAD: emotionText = "SAD"; break; |
|
|
case SAD: emotionText = "SAD"; break; |
|
|
case ANGRY: emotionText = "ANGRY"; break; |
|
|
case ANGRY: emotionText = "ANGRY"; break; |
|
|
case FEAR: emotionText = "FEAR"; break; |
|
|
|
|
|
case SURPRISED: emotionText = "SURPRISED"; break; |
|
|
|
|
|
case DISGUST: emotionText = "DISGUST"; break; |
|
|
|
|
|
case NEUTRAL: emotionText = "NEUTRAL"; break; |
|
|
case NEUTRAL: emotionText = "NEUTRAL"; break; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -135,14 +127,13 @@ void setup(void) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void loop() { |
|
|
void loop() { |
|
|
unsigned long currentTime = millis(); |
|
|
|
|
|
|
|
|
|
|
|
tft.setCursor(0, 0, 2); |
|
|
tft.setCursor(0, 0, 2); |
|
|
int x = readSensor(5); |
|
|
int x = readSensor(5); |
|
|
String emotionText; |
|
|
String emotionText; |
|
|
setupEmotion(emotionText); |
|
|
setupEmotion(emotionText); |
|
|
tcp.receiveImage(); |
|
|
tcp.receiveImage(); |
|
|
drawText(emotionText, x); |
|
|
drawText(emotionText, x); |
|
|
|
|
|
delay(50); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|