ESP8266 code for graphing the ADC

Completado Publicado hace 6 años Pagado a la entrega
Completado 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);

}

Arduino Programación en C Ingeniería eléctrica Electrónica Microcontrolador

Nº del proyecto: #15595497

Sobre el proyecto

17 propuestas Proyecto remoto Activo hace 6 años

Adjudicado a:

anhvu100

What's your specific requirement? I compiled your sample code and it is OK although it can be enhanced, for example, using ajax and using WiFi Manager to connect to WiFi. Relevant Skills and Experience ESP8266, HTML, Más

$200 USD en 5 días
(26 comentarios)
5.4

17 freelancers están ofertando un promedio de $167 por este trabajo

umg536

please ignore the bid amount we will discuss the price later in the chat after we have discussed the project thoroughly Relevant Skills and Experience: . Proposed Milestones: 190 - . Hi robobobo! please inbox me to dis Más

$190 USD en 2 días
(45 comentarios)
7.2
mechatronicsengr

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

$200 USD en 7 días
(99 comentarios)
7.2
SPARKtechBD

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

$250 USD en 7 días
(30 comentarios)
6.3
microembedded

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

$250 USD en 5 días
(36 comentarios)
6.5
sanja1989

As I understand you need to read signal from ADC, save it and then show as SVG. Do you want to automatically update graph? How much data do you want to show? Relevant Skills and Experience I have experience in coding Más

$30 USD en 2 días
(17 comentarios)
5.1
jitendrabaraiya

I can do your job.

$222 USD en 20 días
(11 comentarios)
5.1
sanakashif906

A proposal has not yet been provided

$277 USD en 6 días
(4 comentarios)
2.7
dilshodm

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.

$166 USD en 7 días
(2 comentarios)
1.5
farispcb

Hi, I have experience with arduino, electronics, developing schematic and developing PCB layout. I worked on projects like a smartHome system. I use Arduino IDE for ESP8266 programming. Faris M. Relevant Skills and Ex Más

$177 USD en 4 días
(1 comentario)
0.8
EddyMiner

A proposal has not yet been provided

$35 USD en 3 días
(0 comentarios)
0.0
kenzanin

I have esp8266 and iam using it for my work as embedded designer.

$166 USD en 10 días
(0 comentarios)
0.0
MahmoudBahie

Hello Consider it done just tell me what exactly you want to do .

$222 USD en 4 días
(0 comentarios)
0.0