I uploaded a bluetooth sketch from IDE (File->Examples->Firmata->Standard Firmata) to Arduino Duo.

Now if I have a sensor attached to this Arduino, I can use bluetooth from another device (Raspberry pi or mobilephone) to read the sensor.

But what if I want to do something in the arduino itself? I see only one option which is to edit the standardfirmata to read the sensor and do something. So multiple sketches running in one sketch.

Am I correct?


If you programmed the Arduino to read the sensor and the do something else, what would you do if a second request to read the sensor came in before you had stopped doing something else?

I don't know anything about Firmata. Could you add two sensor's, so the Pi could select to read from sensor 1 or sensor 2? If you could do that then you alter the 'readSensor2()' function so it did 'Something else'. This way you are exploiting any control/synchronisation logic within Firmata. If you need 'readSensor1()' to automatically 'do something else' ever time it was called then couldn't you just tag it onto the end of 'readSensor1()'.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.