Výběr barvy


Výsledek:

#include #include const char* ssid = "RFIDManager"; const char* password = "rfid4life"; WiFiServer server(80); void setup() { Serial.begin(115200); delay(10); WiFi.softAP(ssid, password); server.begin(); } String hex(byte *buffer, byte bufferSize) { String out=""; for (byte i = 0; i < bufferSize; i++) { out+=buffer[i] < 0x10 ? " 0" : " "; out+=buffer[i]; } return out; } String t; String aa="3300",ab="1800"; void loop() { while(Serial.available() > 0) { char c = Serial.read(); if (c == '$' || c == '#') { t=""; } else if(c==';') { t += c; int n = t.length(); char char_array[n+1]; strcpy(char_array, t.c_str()); char *token; char* p=strtok(char_array,",;"); aa=String(p); char* pp=strtok(NULL,",;"); ab=String(pp); } else { t += c; } } WiFiClient client = server.available(); if (!client) { return; } while(!client.available()){ delay(1); } String request = client.readStringUntil('\r'); client.flush(); if(request.indexOf("/RGB")!=-1) { String colors=request.substring(request.indexOf("/RGB")+5,request.indexOf("/END")); Serial.print("$"+colors+";"); return; } client.println("HTTP/1.1 200 OK"); client.println("Content-Type: text/html"); client.println(""); client.println(""); client.println(""); if(request.indexOf("/AJAX")!=-1) { client.print(aa+","+ab); } else { client.print("

Výběr barvy


Výsledek:

"); } delay(1); }