Pages: 1 [2]   Go Down
Author Topic: What is this StandardFirmata_ModifiedAll code doing?  (Read 929 times)
0 Members and 1 Guest are viewing this topic.
universe
Offline Offline
Sr. Member
****
Karma: 0
Posts: 258
I'm enjoying my Life
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Really dumb slave?

It means I must command something to make it works?
And it can not run the code I insert  in it (driving 4digits 7 segments each time the something pass by the IR sensor) ?

The reason I use Firmata because it is GUI so common people no need to type any code to operate the Arduino.
Do you have any better idea?

Thank you for your willing to help.
Logged

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 19
Posts: 3114
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Really dumb slave?
Yes, really dumb slave.

Quote
It means I must command something to make it works?
Yes, the Firmata sketch does nothing but wait for an instruction, and act on it.

Explain what you actually want to do.

What do you want your users to be able to do?

What should the Arduino do in response?
Logged

universe
Offline Offline
Sr. Member
****
Karma: 0
Posts: 258
I'm enjoying my Life
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hmmm, if Firmata sketch waiting for user instruction, then If I insert my code (to drive 4 digits 7 segments by detecting things pass by the sensor, timer using millis) then it should not slave anymore, am I right?

So here I explain what I do:
Now I have been able to drive 4 digits 7 segments as counter (using IR sensor) and timer (using millis), I have build the hardware also the code, it has start/pause button, it works well..

But now I would like to control it not only using manual button, but control it by using PC, that's why I look for GUI.
I decide not to create the GUI since I have no experience on that.
Then I find Firmata GUI, then I try to upload StandarFirmata sketch and it works well ( I test with pin 13),
then I think I see hope to control everything on my Arduino and also get the variable on the Arduino to put it in my database.

I hope this is clear.

Vielen Dank!
Logged

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 19
Posts: 3114
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok. If I understand correctly, you want to put a start/pause button on the PC screen, so that the user can pause the processing. Is that correct?

The sketch you posted (reply #4) contains serial output. What is receiving that output?
Logged

universe
Offline Offline
Sr. Member
****
Karma: 0
Posts: 258
I'm enjoying my Life
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes, you are right I want to put start/pause button on the PC Screen, and also we need to match the COM and serial baud.
And after that I want the PC show the data from the variable looping inside the arduino.

Oh just dont care about that serial output, I don't need that, just put it there, I will just erase it.
It just shows the amount of "no1" variable has been counting up
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 549
Posts: 46107
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

As has been pointed out, Firmata turns your Arduino into a dumb slave. It does ONLY what the driver application tells it to do.

Now, you can ditch Firmata (which I strongly recommend) and develop your own protocol to enable communication between the PC and the Arduino.

The PC could send, for instance, <R8> to have the Arduino read digital pin 8, or <A4> to have the Arduino read analog pin 4, or <S13,0> to have the Arduino set pin 13 to low.

The Arduino simply needs to, on each pass through loop, collect any serial data. When it has a complete packet (the end of packet marker (>) has arrived), it suspends reading serial data, parses the command, executes the command, returns a reply, is appropriate, and resumes reading serial data AND DOING WHATEVER ELSE YOU PROGRAM IT TO DO. Unlike the Firmata case, where ALL it does is read serial data, and act on the commands it receives.
Logged

Pages: 1 [2]   Go Up
Jump to: