YUN reading/getting REST values
hi,
i have 2 yun's , them communicate each other via rest:
here catch: i want second yun get/fetch value of temperature sensor first yun. don not want fist yun initiate transaction, must initiated second yun
i believe the coding of first yun more or less standard followed above mentioned example - through browser can get/fetch value of temperature sensor
my question relates programing of second yun , how program get/fetch data first yun. how go doing ?
the best solution can think of using process.h library , execute curl command get/fetch data first yun. missing ? there better method of getting/fetching data ?
thanks
gregg
i have 2 yun's , them communicate each other via rest:
on first yun, have temperature sensor, in example http://arduino.cc/en/tutorial/temperaturewebpanel#.uxvhd2eraje
on second yun, install lcd screen display temperature first yun http://arduino.cc/en/guide/tft#.uxvip2eraje
here catch: i want second yun get/fetch value of temperature sensor first yun. don not want fist yun initiate transaction, must initiated second yun
i believe the coding of first yun more or less standard followed above mentioned example - through browser can get/fetch value of temperature sensor
my question relates programing of second yun , how program get/fetch data first yun. how go doing ?
the best solution can think of using process.h library , execute curl command get/fetch data first yun. missing ? there better method of getting/fetching data ?
thanks
gregg
this have come with:
it works, best method ?
code: [select]
#include <bridge.h>
#include <process.h>
#include <console.h>
void setup() {
serial.begin(9600);
// bridge startup
pinmode(13,output);
digitalwrite(13, low);
bridge.begin();
digitalwrite(13, high);
console.begin();
while (!console){
; // wait console port connect.
}
console.println("console connected"); console.println("");
digitalwrite(13, low);
}
void loop() {
char result;
string rest_temp;
console.println("getting rest information...");
process temp;
temp.runshellcommand("curl http://x.x.x.x/arduino/rest_test");
while(temp.running());
console.print("receiving data... ");
while (temp.available()>0) {
char result = temp.read();
console.print(result);
rest_temp = rest_temp + result;
}
console.println("");
console.print("temperature via rest: ");
console.println(rest_temp);
// ensure last bit of data sent.
serial.flush();
console.println("done!!!");
console.println("");
delay(2000);
}
it works, best method ?
Arduino Forum > Products > Arduino Yún (Moderator: fabioc84) > YUN reading/getting REST values
arduino
Comments
Post a Comment