oF - ARDUINO communication


hi everyone!

i have application 3 buttons made using openframeworks selects sequence in arduino run, whenever of buttons selected sets variable (b1push, b2push or b3push) message sent arduino:

this written in update() function
code: [select]


       if (b1push){
           prog=1;
       }

       if (b2push){
           prog=2;
       }
       
       if (b3push){
           prog=3;
       }
       
   
       arduinocom.writebyte(prog);


it running @ 9600 bps

on other hand have arduino receiving message, @ 9600 bps, compares button pushed before , sequence activates (eg. if button 1 pushed before, activo = 1) new message received (programa), if activo = programa, nothing , continues run code interrupcion() called. if activo != programa, resets arduino , new sequence:

code: [select]

void interrupcion(){
 programa = serial.read();
 if(programa != activo){
     resetfunc();  //call reset
 }
}


the problem have when sequence running, , push button in of application, takes @ least 5 cycles in arduino before receive of sending, think not synchronized , when of "talking" arduino not listening, , when arduino listening, of not talking, eventually, synchronize (x number of cycles after pushed button) , sequence activates,

how can solve problem? if that's not problem, it?

thank you! , sorry if of english wrong... not native!

hi - use tutorials provided on main site - it's documented there (see here http://arduino.cc/en/serial/available)

hope helps


Arduino Forum > Using Arduino > Programming Questions > oF - ARDUINO communication


arduino

Comments

Popular posts from this blog

Thread: PKI Client 5.00 install (for eToken Pro)

ATmega2560-Arduino Pin Mapping

Crossfader Arduino Tutorial