@@ -5,6 +5,7 @@
|
||||
#include <unistd.h>
|
||||
#include "sendmysql.h"
|
||||
#include "configreader.h"
|
||||
#include "restcurl.h"
|
||||
|
||||
int main(void) {
|
||||
if (wiringPiSetup () == -1)
|
||||
@@ -18,8 +19,8 @@ int main(void) {
|
||||
|
||||
cfginit();
|
||||
|
||||
sensor data;
|
||||
|
||||
sensor data; //data of the raspberrypi
|
||||
data.node_id = 0; //Node ID 0 --> RaspberryPi
|
||||
int i;
|
||||
for (i = 0; i < cfgreadpinamount(); i++) {
|
||||
data.pin = cfgreadpinnumber(i);
|
||||
@@ -27,6 +28,25 @@ int main(void) {
|
||||
printf("Pin: %i, %.2f, %.2f\n", data.pin, data.temperature, data.humidity);
|
||||
insertData(&data);
|
||||
}
|
||||
|
||||
|
||||
sensornode nodes; //Settings of ESP8266 sensor nodes
|
||||
int nodecount;
|
||||
cfgreadsensornodes(&nodes, nodecount); //read settings
|
||||
sensor nodedata; //Should be a linked list for further data usage
|
||||
sensornode *currentNode = nodes;
|
||||
|
||||
|
||||
for (i = 0; i < nodecount; i++) {
|
||||
//start rest requests
|
||||
nodedata.ip = currentNode->ip;
|
||||
getRestSensor(&nodedate);
|
||||
|
||||
printf("Temperature: %f, Humidity: %f, NodeID: %i", nodedata.temperature, nodedata.humidity, nodedata.node_id);
|
||||
|
||||
currentNode = currentNode->next;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user