YunClient client.print not working as I'd like it to work


hello world,


i'm trying create own commands via yunclient using same principle many examples found on internets (analogcommand, digital, dac, etc...)

in fact command works fine, it's i'd print on browser working.

a piece of code explain better:

code: [select]
void digitolcommand(yunclient client) {
 
  client.print("je ventile");
  delay(10000);
  analogwrite(5, 255);
  delay(10000);
  analogwrite(5,0);
}


all previous steps ok said before, i'm testing fan indeed runs 10secs , stops.


but same way when i'm using blabla.local/arduino/digital/4/1 browser displays "digital,4,1" i'd when i'm using blabla.local/arduino/digitol/(whatever) browser displays "je ventile"

any reasons why doesn't work?


merci!

my guess output buffered , not sent immediately, and/or doesn't long delays. long delays cause problems loop accepting new connections.

since you're not sending after delays done, print message, set flag that command has been received, , exit function client object can closed , response flushed out. then, use techniques in blinkwithoutdelay example make simple state machine control output when sees flag indicating command received.

the delay command can problematical, when dealing 20 seconds of delay. loop() function should not take long run.


Arduino Forum > Products > Arduino Yún (Moderator: fabioc84) > YunClient client.print not working as I'd like it to work


arduino

Comments