Initiate/communicate with an arduino sketch?

Questions and discussions about our Arduino add-on board for the Raspberry Pi

Initiate/communicate with an arduino sketch?

Postby arnoldbail » Tue Dec 16, 2014 9:18 pm

Definite NOOB here.
I would like to preload a sketch on the arduino . Then have it initiated via Pymata/Pi Co-op. The sketch would periodically, or during special events, alert the Raspberry Pi (Pymata?).

1. Is this possible?

2. Is there a method to initiate a sketch via Pymata?

3. How, for example, could I use an alert to the RPi?

Arnold
arnoldbail
 
Posts: 7
Joined: Thu Jun 19, 2014 4:40 pm

Re: Initiate/communicate with an arduino sketch?

Postby Alan » Mon Dec 22, 2014 3:22 pm

Hi Arnold,

Sorry for the delayed reply on this. I wanted to have a think about the best answer, and then time flashed by... :oops:

Anyway, the short answer to your question is that, in order to use PyMata with the Pi Co-op, a specific Firmata sketch must be loaded on the Pi Co-op. You can either load this sketch manually using the Arduinio IDE, or it will be automatically loaded for you when the Python PyMata library starts up. Essentially the PyMata library starts up and tries to communicate with the Firmata sketch using serial. If it can't communicate then it automatically uploads the sketch using the Ino library.

So, if you want to use PyMata, you have to either use the Firmata sketch, or you can modify it to do the extra things you want.

What special events exactly do you want to monitor? Can you give some examples please? I think that you might be able to do a lot of what you want just using Python. The main thing you can't do easily is respond to pin interrupts (so respond immediately if a pin on the Pi Co-op goes from high to low).

Regards

Alan
Alan
Site Admin
 
Posts: 311
Joined: Fri Jun 14, 2013 10:09 am

Re: Initiate/communicate with an arduino sketch?

Postby arnoldbail » Sat Jan 03, 2015 4:54 pm

Hi Allan, Thanks for the reply. I too want to apologize for my delayed replying. I've been away. :oops:

You answered my question. Upon reviewing the example sketch, I believe I could use Pymata.

It was basically a philosophical question. Could there be an existing library of Arduino Sketches, which could be executed, as is, using the Pi Co-op board? It seems like you think it can; but, it would take some digging into.

Arnold
arnoldbail
 
Posts: 7
Joined: Thu Jun 19, 2014 4:40 pm

Re: Initiate/communicate with an arduino sketch?

Postby Alan » Mon Jan 05, 2015 8:05 pm

Hi Arnold,

No problem. Hope you had a good break. :)

Glad the answer works for you, if you need help on any specific areas as you continue your work, please let me know.

Regards

Alan
Alan
Site Admin
 
Posts: 311
Joined: Fri Jun 14, 2013 10:09 am


Return to Pi Co-op

Who is online

Users browsing this forum: No registered users and 0 guests