made progress android example sending ir bin to arduino example

This commit is contained in:
strawmanbobi
2025-12-28 18:49:14 +08:00
parent 91a0010cc2
commit 37f5889586
3 changed files with 118 additions and 64 deletions

View File

@@ -27,8 +27,10 @@
#include <cstdint>
// Wi-Fi Configs
#define SECRET_SSID "Maomao的小房子"
#define SECRET_PASS "Maomao121207"
// #define SECRET_SSID "Maomao的小房子"
// #define SECRET_PASS "Maomao121207"
#define SECRET_SSID "maomao"
#define SECRET_PASS "20121207"
// LED Matrix Definitions
constexpr uint32_t chip[] = {

View File

@@ -128,6 +128,16 @@ void setup() {
}
}
void onCommand(const String *command, WiFiClient *client) {
if (command->startsWith(aHello)) {
client->println(eBin);
client->flush();
} else if (command->startsWith(aBin)) {
Serial.println("Received bin command");
Serial.println(*command);
}
}
void loop() {
if (WiFi.status() != WL_CONNECTED) {
Serial.print("Connection lost. Reconnecting...");
@@ -146,9 +156,10 @@ void loop() {
clientConnected = true;
}
if (client.available() > 0) {
if (client.available()) {
String received = client.readStringUntil('\n');
Serial.println(received);
onCommand(&received, &client);
}
} else {
if (clientConnected) {