Yeah after some (LOTS) CSS this could be a nice setup! I will dig through it and see if it a good base for what I want. Thanks for the link!
My plan is to use a esp8266 or the nicer esp32 to make the base controller. Perhaps with a slave esp on the lights and the main connected to a power bar. The esp32 would be better for this as it has bluetooth built in.
I wondered if you could emulate an apex and use their apps and web stuff...
Yeah after some (LOTS) CSS this could be a nice setup! I will dig through it and see if it a good base for what I want. Thanks for the link!
My plan is to use a esp8266 or the nicer esp32 to make the base controller. Perhaps with a slave esp on the lights and the main connected to a power bar. The esp32 would be better for this as it has bluetooth built in.
I wondered if you could emulate an apex and use their apps and web stuff...
That is pretty much what my controller will do, when I get round to porting it onto the ESP32 or ESP8266. Probably more likely to go with the ESP32 for essentially the same reasons you suggest - still about the same price and more powerful! And Bluetooth built in!
Not sure how accurate the built in time keeping is in the ESPs tho - the Arduinos are pretty inaccurate without an RTC, so would be tempted to include an RTC, but automatically set it from an NTP server when the 'net is available.
Tim
Use substring to get the numbers from request and then convert them into an int to assign to whiteLevel (assuming whiteLevel is an int). Assume you'll have to do it in two steps (substring to a string, convert string to int). Does that help or do you want code? No problem if so, but I'd need to check the syntax before offering an example (C++ not a language I use that often...).
Tim
That makes life easierTim if you could that would be awesome. I have a pastebin here with the cobbled ugly code I currently have.
https://pastebin.com/r9D3h6us
Stick an MCP23017 on the ESP via I2C and you can have as many IO pins as you like - just needs the two pins from the ESP and you can add multiple MCP23017s
Tim
lol china i dont support
I have a pastebin here with the cobbled ugly code I currently have.
https://pastebin.com/r9D3h6us
There are a few I2C ADC solutions including:Maybe a bit off topic, but is there something similar to the MCP23017 that allows for analog inputs? It sure would be nice to have a little 16 channel analog read functionality with the ESP chips. I have a perverse desire to have each channel knob-adjustable for testing and possible large-scale and/or professional use (for example, over a working display tank at a storefront, ability to show differences in real time is easier with some knobs for adjustment)where simple dimming control is all you need, with individual channel adjustability for tuning color and PAR.
I have to admit, I haven't looked through your code other than to check the variables I'm playing with, but a simple way to do it:Tim if you could that would be awesome. I have a pastebin here with the cobbled ugly code I currently have.
https://pastebin.com/r9D3h6us
request = "/whiteLevel=255";
if (request.startsWith("/whiteLevel=") != -1) {
request = request.substring(12);
whiteLevel = request.toInt();
Serial.println("WHITE LEVEL SET ");
Serial.println(whiteLevel);
}
if (request.startsWith("/LEDWHITE=") != -1) {
request = request.substring(15,19);
whiteLevel = request.toInt();
Serial.print("WHITE LEVEL SET TO = ");
Serial.println(whiteLevel);
}
if (request.startsWith("/LEDBLUE=") != -1) {
request = request.substring(11,15);
blueLevel = request.toInt();
Serial.println("BLUE LEVEL SET TO = ");
Serial.println(blueLevel);
}
#include <ESP8266WebServer.h>
#include <ESP8266WiFi.h>
#include <time.h>
// Wifi Settings
const char* ssid = "PrettyFlyForAWifi";
const char* password = "reidbuck";
WiFiServer server(80);
// Time Settings
int timezone = 3;
int dst = 0;
int blueLevel = 1000;
int whiteLevel = 1000;
void setup() {
Serial.begin(115200);
delay(1);
// Connect to WiFi network
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
// Start the server
server.begin();
Serial.println("Server started");
// Print the IP address
Serial.print("Use this URL to connect: ");
Serial.print("http://");
Serial.print(WiFi.localIP());
Serial.println("/");
}
void loop() {
// Check if a client has connected
WiFiClient client = server.available();
if (!client) {
return;
}
// Wait until the client sends some data
Serial.println("new client");
// Read the first line of the request
String request = client.readStringUntil('\r');
Serial.println(request);
client.flush();
// Web Page Bit
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println();
client.println("<HTML>");
client.println("<HEAD>");
client.println("<TITLE>LED Control Module</TITLE>");
client.println("</HEAD>");
client.println("<BODY>");
client.println("<FORM ACTION='/' method=get >"); //uses IP/port of web page
client.println("Set White Led Level: <INPUT TYPE=TEXT NAME='LEDWHITE' VALUE='' SIZE='25' MAXLENGTH='50'><BR>");
client.println("<INPUT TYPE=SUBMIT NAME='submit' VALUE='Send White LED Level'>");
client.println("</FORM>");
client.println("<BR>");
client.println("<FORM ACTION='/' method=get >"); //uses IP/port of web page
client.println("Set Blue Level: <INPUT TYPE=NUMBER NAME='LEDBLUE' VALUE='' SIZE='25' MAXLENGTH='50'><BR>");
client.println("<INPUT TYPE=SUBMIT NAME='submit' VALUE='Send Blue LED Level'>");
client.println("</FORM>");
client.println("<BR>");
client.println("</BODY>");
if (request.startsWith("/LEDWHITE=") != -1) {
request = request.substring(15,19);
whiteLevel = request.toInt();
Serial.print("WHITE LEVEL SET TO = ");
Serial.println(whiteLevel);
Serial.println("Flush the variable Request");
request = "Flushed";
}
if (request.startsWith("/LEDBLUE=") != -1) {
request = request.substring(11,15);
blueLevel = request.toInt();
Serial.println("BLUE LEVEL SET TO = ");
Serial.println(blueLevel);
Serial.println("Flush the variable Request");
request = "Flushed";
}
Serial.println(whiteLevel);
Serial.println(blueLevel);
delay(1);
Serial.println("Client disonnected");
Serial.println("");
}
if (request.startsWith("/LEDWHITE=") != -1) {
Serial.println(request);
request = request.substring(15,19);
Serial.println(request);
whiteLevel = request.toInt();
Serial.print("WHITE LEVEL SET TO = ");
Serial.println(whiteLevel);
}
if (request.startsWith("/LEDBLUE=") != -1) {
Serial.println(request);
request = request.substring(11,15);
Serial.println(request.substring(11,15));
blueLevel = request.toInt();
Serial.println("BLUE LEVEL SET TO = ");
Serial.println(blueLevel);
}