User Tools

Site Tools


proiecte:influxdb

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
proiecte:influxdb [2017/02/16 00:44]
mihai.volmer [ESP8266]
proiecte:influxdb [2017/02/16 00:46] (current)
mihai.volmer [ESP8266]
Line 113: Line 113:
  
 We made two implementations that send data from an LDR sensor to the server. We made two implementations that send data from an LDR sensor to the server.
 +
 +<code>
 +const int LDR = A0;
 +void loop() {
 +   int ldr = analogRead(LDR);
 +   Serial.printf("LDR value = %d\n", ldr);
 +
 +   send_value(ldr);
 +
 +   delay(500);
 +}
 +</code>
  
 ==== Sendint to HTTP endpoint (TCP) ==== ==== Sendint to HTTP endpoint (TCP) ====
Line 132: Line 144:
    client.print("POST /write?db=mydb HTTP/1.1\r\n");    client.print("POST /write?db=mydb HTTP/1.1\r\n");
    client.print("User-Agent: esp8266/0.1\r\n");    client.print("User-Agent: esp8266/0.1\r\n");
-   client.print("Host: 52.59.218.207:8086\r\n");+   client.print("Host: localhost:8086\r\n");
    client.print("Accept: */*\r\n");    client.print("Accept: */*\r\n");
    client.print("Content-Length: " + String(content.length()) + "\r\n");    client.print("Content-Length: " + String(content.length()) + "\r\n");
proiecte/influxdb.1487198643.txt.gz · Last modified: 2017/02/16 00:44 by mihai.volmer