Show Posts
Pages: [1] 2
1  Forum 2005-2010 (read only) / Syntax & Programs / Re: MIDI over serial Arduino code on: April 21, 2007, 02:59:35 pm
Hey,
I'm not familiar with the driver itself, but if you just need to send standard midi data over the serial port then this site has a pretty comprehensive overview of the midi protocol.  Basically you send a single command byte (which says what type of message you are sending) then further bytes describing the message.  You might like to have a look at firmata, which uses a slightly funky implementation of midi messages to communicate to/from the arduino.
Joe
2  Forum 2005-2010 (read only) / Interfacing / Re: Arduino + Firmata + Pyduino (Python) on: July 24, 2008, 03:19:17 am
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
3  Forum 2005-2010 (read only) / Interfacing / Re: Arduino + Firmata + Pyduino (Python) on: January 17, 2008, 08:26:38 pm
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
4  Forum 2005-2010 (read only) / Interfacing / Re: Arduino + Firmata + Pyduino (Python) on: January 07, 2008, 02:24:15 pm
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
5  Forum 2005-2010 (read only) / Interfacing / Re: Arduino + Firmata + Pyduino (Python) on: January 07, 2008, 05:49:05 am
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
6  Forum 2005-2010 (read only) / Interfacing / Re: Arduino + Firmata + Pyduino (Python) on: January 04, 2008, 02:38:40 pm
Yeah, that'd be great if you could.  My email's in the linky thing at the bottom of the posts.
7  Forum 2005-2010 (read only) / Interfacing / Re: Arduino + Firmata + Pyduino (Python) on: January 04, 2008, 02:01:59 pm
Brilliant!  Over the next couple of days I'll put up a new version of Pyduino which has your changes in, and contains the working firmware so we don't have this problem again.  Thanks for all of your help dylpkls91 and mellis.
Joe
8  Forum 2005-2010 (read only) / Interfacing / Re: Arduino + Firmata + Pyduino (Python) on: January 04, 2008, 09:33:20 am
Right, I think that I almost know what's going on now...maybe
The iterate and sleep should definitely be in __init__ - that's my fault.  The iterate after get_firmata_version() grabs the bytes sending the version, everything I've done before has been looping over iterate so I didn't notice.
I think that the problem setting the digital pin is in the 0010 version of firmata, although it does compile.  I'm going to take a guess that the compile errors in rev 1.3 are to do with port_to_input_PGM not being found.  If so try putting
Code:
#include <pins_arduino.h>
after the EEPROM include in firmata.  I think it should compile then and (hopefully) work with 57600 bitrate.  If it compiles and doesn't work then we're back to it being my fault.  If it doesn't compile then can you post up the errors - I remember I had to do a little tweaking to get 1.30 to compile with 0010 (probably just the include), but I thought it was my fault botching the new versions of everything.
Cheers
Joe
9  Forum 2005-2010 (read only) / Interfacing / Re: Arduino + Firmata + Pyduino (Python) on: January 03, 2008, 07:08:37 am
Mellis: No I hadn't tested with a Diecimila - there was a post on the mailing list saying that Firmata worked better with the automatic reset, but I think that sending a couple of bytes to get the version straight after initializing the connection could be a problem.  But not this problem evidently - I think it might be a bug on top of a bug smiley-grin  I'll stick a sleep in a new version once I know what's causing this.

dylpkls91: Ok, could you try running this - it's about as basic as it can get.

Code:
import pyduino
a = pyduino.Arduino("com5")
print a.get_firmata_version()

You should see the status LED strobe a pattern at the start (giving the major and minor version of firmata).  Then there should be another quick blip or two from the status pin, and you should get a version number back.  If this works then then serial communication with firmata is OK, and it's probably something in my digital code which is a little sketchy  smiley  If you could try this at both bitrates it'd be much appreciated too.

Also if none of that works could you give it a go using rev 1.3 of firmata.  I think there's a chance that the serial initiation code has gone amiss in the change to using firmata as a library (I can't find it in the 0.10 arduino code anyway...)

Sorry I can't debug this myself at the moment, and cheers for looking into it.
Joe

10  Forum 2005-2010 (read only) / Interfacing / Re: Arduino + Firmata + Pyduino (Python) on: January 02, 2008, 12:31:31 pm
Hi, I wrote pyduino, so this is almost certainly my fault  smiley
Can you post the python you were using (if it isn't just the example), and any errors you're getting.  I've not got my arduino with me for a few days, but last time I used it I had it working fine.  One possibility is that firmata is now working at the 115200 bitrate - I need to check properly, but it's either happened or happening soon.  I'm so behind with my arduino news  smiley
If thats the problem you could try changing line 51 of pyduino.py from
Code:
self.sp = serial.Serial(port, 57600, timeout=0.02)
to
Code:
self.sp = serial.Serial(port, 115200, timeout=0.02)

I'll be able to have a proper look in a few days time, but any more info would be much appreciated.
Joe
11  Forum 2005-2010 (read only) / Interfacing / Re: arduino --> OSC on: March 26, 2008, 08:35:16 am
Hi, yeah, it is possible but (at least the way I'm doing it takes a little bit to set up).  I really should write a proper write up some day...  Anyway, the way I've been doing it is Arduino (with Firmata loaded onto it) => Python =>OSC.
So (and I'm sorry, this won't be very complete instructions because I've got far too much work to do  smiley):
Thing which need to be installed/done:
Python (www.python.org/)
pySerial (pyserial.sourceforge.net/)
pyOSC (http://trac.v2.nl/wiki/pyOSC)
and put Firmata (http://www.arduino.cc/playground/Interfacing/Firmata) onto your Arduino.

Then stick these two in a folder:
pyduino.py (this is a slightly newer version than the one packaged on the Firmata page, there will be a new package for the 0011 release)
http://pyduino.pastebin.com/m60b2c529

arduino_osc.py
http://pyduino.pastebin.com/m5d9aca8d

Then if you run arduino_osc.py it should send osc values to /Arduino/Analog on the port you specify.  It's pretty simple to add digital reading in too - if you read the pyduino and pyOSC code you should be able to work it out I think.

Sorry this is pretty minimal, but I hope it helps.
Joe




  
12  Forum 2005-2010 (read only) / Interfacing / Re: arduino and pthon why not working? on: April 07, 2008, 06:16:28 pm
You need the win32all extension - see https://sourceforge.net/projects/pywin32/ for downloads.
Joe
13  Forum 2005-2010 (read only) / Interfacing / Re: arduino -> processing -> glovepie on: March 26, 2008, 02:29:43 pm
I think what you want is to use the GlovePie OSC output to an OSC input in processing using oscP5 (http://www.sojamo.de/libraries/oscP5/).  From this you can send the data using the processing serial library to the Arduino.
Hope this helps
Joe
14  Forum 2005-2010 (read only) / Interfacing / Re: Student seeking help... on: March 16, 2008, 10:09:07 am
That all sounds very possible to me  smiley
I've not used it myself, but there's a library and firmware here for flash which should mean all you need to worry about is getting the videos sorted in flash and the arduino side will be pretty much done for you.  There's a quick reference for you to see just how easy it (should...) be to get the button presses in to the app here.

Good luck!
Joe
15  Forum 2005-2010 (read only) / Interfacing / Re: Arduino+Firmata+Pduino+Linux on: January 30, 2008, 06:29:11 am
I think the easiest way to get it is as part of pd-extended (which coincidentally is maintained by the person who wrote firmata - small world huh?).  The stable releases are here: http://puredata.info/downloads

If you just want comport you can find it in the PD cvs under externals/iem/comport.  CVS browse here.

Hope this helps
Joe
Pages: [1] 2