How to take data from other node?


#1

Hi everyone

I don’t understand how to take data from other node. For example, in the first node i have this code

thing[“LDR”] >> [](pson& out){
out = analogRead(LDR);
};

And i want a second node to take this value and make something. So i write this code on second node

unsigned int current_lum = 0;

thing[“LDR”] << [](pson& in){
if (in.is_empty()){
in = current_lum;
} else {
current_lum = in;
}
};

void loop() {
thing.handle();

Serial.println(current_lum); //value is always zero
}

What is the mistake? I have the free license so far

Thanks in advance!


#2

HI, you are just defining an input resource in one device, and an putout resource in another resource. You must just send information from one device to another. Take a look to the documentation:

http://docs.thinger.io/arduino/#coding-communication-between-devices