NeoPixel ring colour picker with touch and drag support from Mobile device through NodeMCU over WiFi using javaScript

Arduino Program

#include <Adafruit_NeoPixel.h#ifdef __AVR__ #include <avr/power.h// Required for 16 MHz Adafruit Trinket #endif #define PIN D2 #define NUMPIXELS 16 Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); #define DELAYVAL 500 // Time (in milliseconds) to pause between pixels #include <ESP8266WiFi.h#include <ESP8266WebServer.h#include <FS.hconst char* htmlFile = "/index.html"; const char* ssid = "NodeMCU"; const char* password = "xxxxxxxxxxx"; int count = 0; #define LED 2 ESP8266WebServer server(80); void handleRoot() { server.sendHeader("Location",
Read More
NeoPixel ring colour picker from Mobile device through NodeMCU over WiFi using jQuery

Arduino Program

#include <Adafruit_NeoPixel.h#ifdef __AVR__ #include <avr/power.h// Required for 16 MHz Adafruit Trinket #endif #define PIN D2 #define NUMPIXELS 16 Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); #define DELAYVAL 500 // Time (in milliseconds) to pause between pixels #include <ESP8266WiFi.h#include <ESP8266WebServer.h#include <FS.hconst char* htmlFile = "/index.html"; const char* ssid = "NodeMCU"; const char* password = "xxxxxxxxxxx"; int count = 0; #define LED 2 ESP8266WebServer server(80); void handleRoot() { server.sendHeader("Location",
Read More
Real time data monitoring from NodeMCU through graphical interface using jQuery

Arduino Program

#include <ESP8266WiFi.h#include <ESP8266WebServer.h#include <FS.hconst char* htmlFile = "/index.html"; const char* ssid = "NodeMCU"; const char* password = "xxxxxxxxxxx"; int count = 0; #define LED 2 ESP8266WebServer server(80); void handleRoot() { server.sendHeader("Location", "/index.html", true); server.send(302, "text/plane", ""); } void handlePWM() { String PWM = server.arg("pwm"); int p = 1024 - (PWM.toInt()) * 10; Serial.println(p); analogWrite(LED, p); server.send(200, "text/plane", ""); } void getCount() { server.send(200, "text/plain", String(count).c_str()); Serial.print("Sending "); Serial.print(count); Serial.println(" to the client device...");
Read More
Web interface from NodeMCU – Part 5, jQuery and Bootstrap on NodeMCU

Arduino Program

#include <ESP8266WiFi.h#include <ESP8266WebServer.h#include <FS.hconst char* htmlFile = "/index.html"; const char* ssid = "NodeMCU"; const char* password = "xxxxxxxxxxx"; int count = 0; ESP8266WebServer server(80); void handleRoot() { server.sendHeader("Location", "/index.html", true); server.send(302, "text/plane", ""); } void handleWebRequests() { if(loadFromSpiffs(server.uri())) return; String message = "File not detected\n\n"; message += "URI: "; message += server.uri(); message += "\nMethod: "; message += (server.method() == HTTP_GET)?"GET":"POST"; message += "\nArguments: "; message += server.args(); message += "\n";
Read More
Web interface from NodeMCU – Part 4, Scan and list available WiFi networks

WiFiNewLibrary.h (Download this file from the attachment given below)

WiFiNewLibrary_hDownload

WiFiNewLibrary.cpp

#include "WiFiNewLibrary.h" WiFiNewLibrary::WiFiNewLibrary() { } void WiFiNewLibrary::setupConfigPortal() { server.reset(new ESP8266WebServer(80)); if(_apPassword != NULL) { if(strlen(_apPassword) < 8 || strlen(_apPassword) 63) { Serial.println("Invalid password..."); _apPassword = NULL; } } if(_apPassword != NULL) { WiFi.softAP(_apName, _apPassword); } else { WiFi.softAP(_apName); } Serial.println("AP IP Address"); Serial.println(WiFi.softAPIP()); server -on(String(F("/")).c_str(), std::bind(&WiFiNewLibrary::handleRoot,
Read More
Web interface from NodeMCU – Part 3, List available WiFi networks

WiFiNewLibrary.h (Download from the attachment given below)

WiFiNewLibrary_hDownload

WiFiNewLibrary.cpp

#include "WiFiNewLibrary.h" WiFiNewLibrary::WiFiNewLibrary() { } void WiFiNewLibrary::setupConfigPortal() { server.reset(new ESP8266WebServer(80)); if(_apPassword != NULL) { if(strlen(_apPassword) < 8 || strlen(_apPassword) 63) { Serial.println("Invalid password..."); _apPassword = NULL; } } if(_apPassword != NULL) { WiFi.softAP(_apName, _apPassword); } else { WiFi.softAP(_apName); } Serial.println("AP IP Address"); Serial.println(WiFi.softAPIP()); server -on(String(F("/")).c_str(), std::bind(&WiFiNewLibrary::handleRoot, this)); server -on(String(F("/wifi")).c_str(), std::bind(&WiFiNewLibrary::handleWiFi, this, true)); server -begin();
Read More
Web interface from NodeMCU – Part 2, Scan WiFi networks

WiFiNewLibrary.h

#ifndef WiFiNewLibrary_h #define WiFiNewLibrary_h #include <ESP8266WiFi.h#include <ESP8266WebServer.h#include <memoryextern "C" { #include "user_interface.h" } const char HTTP_HEADER[] PROGMEM = "<!DOCTYPE html<html lang=\"en\"<head<meta charset=\"UTF-8\"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, user-scalable=no\"/<title{v}</title"; const char HTTP_STYLE[] PROGMEM = "<style.c{text-align: center;} div,input{padding:5px;font-size:1em;} input{width:95%;} body{text-align: center;font-family:verdana;} button{border:0;background-color: #58d68d;color:#fff;line-height:2.4rem;font-size:1.2rem;width:100%;} .q{float: right;width: 64px;text-align: right;} </style"; const char HTTP_HEADER_END[] PROGMEM = "</head<body<div style='text-align:left;display:inline-block;min-width:260px;'"; const char HTTP_PORTAL_OPTIONS[] PROGMEM = "<form action=\"/wifi\" method=\"get\"<buttonConfigure WiFi</button</form<br/<form action=\"/i\" method=\"get\"<buttonESP8266 Info</button</form<br/<form action=\"/r\" method=\"post\"<buttonReset ESP8266</button</form";
Read More
Web interface from NodeMCU – Part 1, Basic interface

WiFiNewLibrary.h

#ifndef WiFiNewLibrary_h #define WiFiNewLibrary_h #include <ESP8266WiFi.h#include <ESP8266WebServer.h#include <memoryextern "C" { #include "user_interface.h" } const char HTTP_HEADER[] PROGMEM = "<!DOCTYPE html<html lang=\"en\"<head<meta charset=\"UTF-8\"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, user-scalable=no\"/<title{v}</title"; const char HTTP_STYLE[] PROGMEM = "<style.c{text-align: center;} div,input{padding:5px;font-size:1em;} input{width:95%;} body{text-align: center;font-family:verdana;} button{border:0;background-color: #58d68d;color:#fff;line-height:2.4rem;font-size:1.2rem;width:100%;} .q{float: right;width: 64px;text-align: right;} </style"; const char HTTP_HEADER_END[] PROGMEM = "</head<body<div style='text-align:left;display:inline-block;min-width:260px;'"; const char HTTP_PORTAL_OPTIONS[] PROGMEM = "<form action=\"/wifi\" method=\"get\"<buttonConfigure WiFi</button</form<br/<form action=\"/i\" method=\"get\"<buttonESP8266 Info</button</form<br/<form action=\"/r\" method=\"post\"<buttonReset ESP8266</button</form";
Read More
0-9999 UP counter with RESET from Arduino UNO

Circuit is done as shown in the diagram. Upload the following program to Arduino UNO.

const int CLK = 2; const int RESET = 3; int count = 0; int countLimit = 36; // the setup function runs once when you press reset or power the board void setup() { pinMode(CLK, OUTPUT); pinMode(RESET, OUTPUT); digitalWrite(RESET, HIGH); delay(100); digitalWrite(RESET, LOW); } // the loop function runs over and over again forever void loop() { digitalWrite(CLK,
Read More
0 – 9999 counter module using Arduino UNO

Circuit is done as shown in the diagram. Upload the following program to Arduino UNO.

// the setup function runs once when you press reset or power the board void setup() { pinMode(2, OUTPUT); } // the loop function runs over and over again forever void loop() { digitalWrite(2, HIGH); // turn the LED on (HIGH is the voltage level) delay(100); // wait for 100 mS digitalWrite(2, LOW); // turn the LED off by making the voltage LOW delay(100);
Read More
X