Pages: 1 [2] 3   Go Down
Author Topic: Arduino + Firmata + Pyduino (Python)  (Read 5548 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 18
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah, that'd be great if you could.  My email's in the linky thing at the bottom of the posts.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 41
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hmmm...

I've been playing around some more, and it seems like reading analog and digital inputs only works in a "while True" loop like the one in the pyduino example. I can't just grab an input's value once, it returns a 0.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 18
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah, I get this too - I've got a fix for analog, just need to get a free hour to look at digital.  What happens is that there is a delay between activating a pin and getting values out, so it just returns zero (a default value).  I think I should be able to have a look this afternoon.
Joe
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 41
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Great, once that's fixed, it'll be set!  ;D
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 18
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Right - half success...
Analog works fine afaik, and is not too bad code wise.  Digital is however pretty sketchy I'm afraid.  Anyway, here's a new version of pyduino: http://rafb.net/p/u9u2QP86.html
...and a rough idea of how it should work: http://rafb.net/p/FjOkxU38.html

As you can see, the analog iterates until it does not return -1 (i.e. a value has been assigned to the analog pin).  This would be OK to do with digital, but there is no way of knowing whether the digital pin has been activated or not, as it only signals on a change.  This is in the TODO for firmata, so will hopefully be in the next version.  For now you can work around it by iterating for a while after the pin is activated so it has time to get a value.

On the plus side this has helped me find a big old bug in the digital handling, so it's all been good and worthwhile  smiley
Let me know how this one goes
Joe
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 41
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks, I'll let you know how it goes.

I almost forgot, do you want to add the extra Diecimila pwm pins 3, 5, and 6 to the constant PWM_PINS? You may not want to, though, because AFAIK there's no way to tell which type of board Firmata is running on.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 41
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

P.S. - Hopefully the next version of Firmata is out soon, to fix the digital input problem. Do you have any idea how active Firmata development is?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 43
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Links are broken...

http://rafb.net/p/FjOkxU38.html and http://rafb.net/p/u9u2QP86.html are both 404 for me....
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 18
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry, they were just up for a day or so for testing.  I'll get a proper tarball out over the next couple of days.  For now here's the links:
http://pyduino.pastebin.com/f2b76d85e
http://pyduino.pastebin.com/m69d01f2d

Joe
Logged

Brooklyn, NY, USA
Offline Offline
Full Member
***
Karma: 0
Posts: 115
arduino for all
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey

Did that tarball ever get released?  If so, please update the link on the Firmata page, under Host Implementations:

http://www.arduino.cc/playground/Interfacing/Firmata

Also, let me know if you want any help updating pyduino to work with Firmata v2.0.  It is slated to be included in Arduino 12 and we are working towards making it the default firmware that Arduinos ship with, so it would be good to have pyduino working with it.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 18
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Oh gawd, it never did.  I'll have a look this weekend and see what sort of state it's in and give a go at making a version which works with 2.0.  If I have any problems I'll drop an email to the ML.
Cheers
Joe
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 1
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The link on the firmata site is still code from 2007.04.09.  Any chance you could put the pyduino code on berlios or sourceforge so that we can help you get it up and running.
Logged

Berlin, Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 2
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Today i wrote orphans a mail asking if he can send me his newest pyduino version.
He was super-reactive and published it.
The link is in the next post from me, since this is my first, and some spam eater in this forum software doesnt want a link to show up in a first post.

This works very well with Firmata 2.0, wow!
I am using the Firmata sketchbook included in arduino-012, btw.

So, huge thanks to orphans!
Logged

Berlin, Germany
Offline Offline
Newbie
*
Karma: 0
Posts: 2
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The link to pyduino:

http://code.google.com/p/pyduino/
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 12
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've modified the pyduino library to work with firmata 2.1, everything work except i2c comunication
Logged

Pages: 1 [2] 3   Go Up
Jump to: