Go Down

Topic: Arduino + Firmata + Pyduino (Python) (Read 6463 times) previous topic - next topic

orphans

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

dylpkls91

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.

orphans

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

dylpkls91

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

orphans

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  :)
Let me know how this one goes
Joe

dylpkls91

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.

dylpkls91

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?

wrybread

Links are broken...

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

orphans

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

eighthave

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.

orphans

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

dirty_hands

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.

kap

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!

kap

The link to pyduino:

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

rferrazz

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

Go Up