Multithreading or Interrupts with Arduino Code?


     i have arduino sketch running wifi shield , bluetooth module.  problem loop long (about 3 seconds) program laggy in responding bluetooth command inputs. give details below, conceptually want use either multithreading or interrupt type programming instead of 1 big loop , input how accomplish things.

     i try describe detail necessary program answer can more conceptual specific. program this:

    create wificlient client
    create serial bluetooth , begin

    loop start
        connect client apk , var1, stop client
        connect client website , var2, stop client
        check bluetooth available , var 3
        various processing of data
       output
    loop end

     my problem wifi clients connections take 3 seconds or more, sketch responding bluetooth remote every 3 seconds or so. gives awkward feel ("nothing happened, should press button again…"). not programming anyway because think processor idle during of wifi client connections.
     can run wifi clients connect blocks in multithread fashion , keep main loop running faster while wifi client connections running in background? arduino programming support multithreading?
     or can use interrupt somehow immediate reaction bluetooth input, if code in wifi client section of code?
     any tips multithreading, interrupts or other ways above sketch better appreciated.

thank, drew

did write wife client connection code, or third party?


Arduino Forum > Using Arduino > Programming Questions > Multithreading or Interrupts with Arduino Code?


arduino

Comments