/******* work *******/ #include #include #include #include const char* ssid = "YOUR_SSID"; const char* password = "YOUR_PASSWORD"; const char* serverUrl = "http://xxx.xxx.x.xx/rgb"; #define LED_PIN 6 #define STP_PIN 5 #define NUM_LEDS 20 #define NUMPIXELS 2 // Popular NeoPixel ring size Adafruit_NeoPixel strip(NUM_LEDS, STP_PIN, NEO_GRB + NEO_KHZ800); //Adafruit_NeoPixel pixels(NUMPIXELS, LED_PIN, NEO_RGBW + NEO_KHZ800); // この行を変更 void setup() { //Serial.begin(115200); Serial.begin(9600); WiFi.begin(ssid, password); Serial.print("Connecting"); int retry=0; while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); retry++; /* if (retry > 20) { Serial.println("\nWiFi connection failed!"); Serial.printf("Status code: %d\n", WiFi.status()); return; } */ } Serial.println("\nConnected!"); //pixels.begin(); //pixels.show(); strip.begin(); strip.show(); Serial.println("client start"); } void loop() { if (WiFi.status() == WL_CONNECTED) { HTTPClient http; http.begin(serverUrl); int httpCode = http.GET(); Serial.println("start"); //Serial.println("httpcode:" + httpCode); Serial.print("httpcode:"); Serial.println(httpCode); if (httpCode == 200) { String payload = http.getString(); StaticJsonDocument<200> doc; DeserializationError error = deserializeJson(doc, payload); if (!error) { int r = doc["r"]; int g = doc["g"]; int b = doc["b"]; Serial.printf("Received: R=%d, G=%d, B=%d\n", r, g, b); for(int i=0; i