Go Down

Topic: Write command on shell automatically using sketch for ARDUINO YUN  (Read 828 times) previous topic - next topic

pipita20

Goodmorning everyone,
I'm implementing the lwm2m client on arduino yun based on this project:
 

https://github.com/HOP-Ubiquitous/OMA-ArduinoYun/tree/master/ArduinoLwM2MLib


my problem is that after having correctly established the connection with the server I cannot change the values ​​related to the sensors. the code is as follows:

Code: [Select]

 Process p;
  int temp = 0;
 void setup() {
 SerialUSB.begin(9600);   
 while (!SerialUSB);   
 
 
 SerialUSB.println("Init  bridge lib...\n");       
 Bridge.begin();   
 String conn = "/root/./lwm2mclient -h leshan.eclipse.org -n arduino_yun_client -4";   
  p.runShellCommandAsynchronously(conn); 

  }

 void loop() {   
 
  temp = 0;
     Serial.println(temp);   
   changeResource("/1024/0/10", temp);
     delay(1500);
 


 void changeResource(String resource, int value){
    String conn = "change "+resource+" "+value;   
  p.println(conn);   
  p.flush(); 
    }


n particular, the changeResource method is not executed, which allows the values ​​related to the sensors to be changed. Or rather, the method is executed but actually p.println (conn) and p.flush () do not send any commands.

N.B. running the client (./lwm2mclient -h leshan.eclipse.org -n arduino_yun_client -4) and then entering the command change / 1024/0/10 5
 from arduino, through ssh it works perfectly.

Go Up