ESP8266 code for graphing the ADC
$30-250 USD
Pagado a la entrega
I need some code to graph the analog to digital pin of the esp8266.
I have some sample code.
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
const char *ssid = "YourSSIDHere";
const char *password = "YourPSKHere";
ESP8266WebServer server ( 80 );
const int led = 13;
void handleRoot() {
digitalWrite ( led, 1 );
char temp[400];
int sec = millis() / 1000;
int min = sec / 60;
int hr = min / 60;
snprintf ( temp, 400,
"<html>\
<head>\
<meta http-equiv='refresh' content='5'/>\
<title>ESP8266 Demo</title>\
<style>\
body { background-color: #cccccc; font-family: Arial, Helvetica, Sans-Serif; Color: #000088; }\
</style>\
</head>\
<body>\
<h1>Hello from ESP8266!</h1>\
<p>Uptime: %02d:%02d:%02d</p>\
<img src=\"/[login to view URL]\" />\
</body>\
</html>",
hr, min % 60, sec % 60
);
[login to view URL] ( 200, "text/html", temp );
digitalWrite ( led, 0 );
}
void handleNotFound() {
digitalWrite ( led, 1 );
String message = "File Not Found\n\n";
message += "URI: ";
message += [login to view URL]();
message += "\nMethod: ";
message += ( [login to view URL]() == HTTP_GET ) ? "GET" : "POST";
message += "\nArguments: ";
message += [login to view URL]();
message += "\n";
for ( uint8_t i = 0; i < [login to view URL](); i++ ) {
message += " " + [login to view URL] ( i ) + ": " + [login to view URL] ( i ) + "\n";
}
[login to view URL] ( 404, "text/plain", message );
digitalWrite ( led, 0 );
}
void setup ( void ) {
pinMode ( led, OUTPUT );
digitalWrite ( led, 0 );
[login to view URL] ( 115200 );
[login to view URL] ( WIFI_STA );
[login to view URL] ( ssid, password );
[login to view URL] ( "" );
// Wait for connection
while ( [login to view URL]() != WL_CONNECTED ) {
delay ( 500 );
[login to view URL] ( "." );
}
[login to view URL] ( "" );
[login to view URL] ( "Connected to " );
[login to view URL] ( ssid );
[login to view URL] ( "IP address: " );
[login to view URL] ( [login to view URL]() );
if ( [login to view URL] ( "esp8266" ) ) {
[login to view URL] ( "MDNS responder started" );
}
[login to view URL] ( "/", handleRoot );
[login to view URL] ( "/[login to view URL]", drawGraph );
[login to view URL] ( "/inline", []() {
[login to view URL] ( 200, "text/plain", "this works as well" );
} );
[login to view URL] ( handleNotFound );
[login to view URL]();
[login to view URL] ( "HTTP server started" );
}
void loop ( void ) {
[login to view URL]();
}
void drawGraph() {
String out = "";
char temp[100];
out += "<svg xmlns=\"[login to view URL]\" version=\"1.1\" width=\"400\" height=\"150\">\n";
out += "<rect width=\"400\" height=\"150\" fill=\"rgb(250, 230, 210)\" stroke-width=\"1\" stroke=\"rgb(0, 0, 0)\" />\n";
out += "<g stroke=\"black\">\n";
int y = rand() % 130;
for (int x = 10; x < 390; x+= 10) {
int y2 = rand() % 130;
sprintf(temp, "<line x1=\"%d\" y1=\"%d\" x2=\"%d\" y2=\"%d\" stroke-width=\"1\" />\n", x, 140 - y, x + 10, 140 - y2);
out += temp;
y = y2;
}
out += "</g>\n</svg>\n";
[login to view URL] ( 200, "image/svg+xml", out);
}
Nº del proyecto: #15595497
Sobre el proyecto
17 freelancers están ofertando un promedio de $167 por este trabajo
Hi I hope you are doing well. I have experience in esp8266 based webserver development. I have understood your project requirements and I can execute it in less possible time. Looking Forward Khawaja
Read and checked your project description. It is not clear that what you want. Please mark your requirements clearly. However, I like to work in this project as I have Arduino experience. Relevant Skills and Experienc Más
hi i am an electrical engineer. i have vast experience related to esp8266 and its programming. i have done many embedded system projects. Relevant Skills and Experience i have hardware experience with esp8266. let me Más
hello, I can help with this project. Can you describe, please, what is the rate of ADC data sampling and what is the timeframe for the data showed on the graphic? I.e. 5 seconds of data.