Hello everyone!
I am trying to send data to the cloud (Ubidots) without having to enter manually the values of temperature and humidity on the linux console using curl like in step #7 of this tutorial: http://ubidots.com/docs/get_started/quickstart/tutorial-collections.html
This method works on real time without any delay but, for instance, if I want to record data of temperature and humidity of a house for 1 week, I won’t be able to do so as a user would have to be continously enter the values on the linux terminal using this command:
curl -XPOST -H ‘Content-Type: application/json;’ -H ‘X-Auth-Token: ENTER_TOKEN_HERE’ -d ‘[{“variable”: “ID_TEMPERATURE”, “value”: 23}, {“variable”: “ID_HUMIDITY”, “value”: 43.97}]’ http://things.ubidots.com/api/v1.6/collections/values
I am using Contiki OS and I receive values of temperature and humidity in real time using a temperature and humidity sensor. I’m running a program (test-sht25.c) where its output are the values of temperature and humidity. The code of my program is this one:
#include < stdio.h >
#include "contiki.h"
#include "dev/sht25.h"
PROCESS(test_sht25_process, "SHT25 test");
AUTOSTART_PROCESSES(&test_sht25_process);
static struct etimer et;
PROCESS_THREAD(test_sht25_process, ev, data)
{
int16_t temperature, humidity;
PROCESS_BEGIN();
SENSORS_ACTIVATE(sht25);
while(1) {
etimer_set(&et, CLOCK_SECOND * 15);
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
temperature = sht25.value(SHT25_VAL_TEMP);
printf("Temperature %d.%d ºC\n", temperature / 100, temperature % 100);
humidity = sht25.value(SHT25_VAL_HUM);
printf("Humidity %d.%d %%RH\n", humidity / 100, humidity % 100);
}
PROCESS_END();
}
So basically I want the output of my program to be the input of the curl command line on linux (I want to replace the values of temperature (23) and humidity (43.97) with the values I get on my program).