[dorkbotpdx-blabber] (2nd try) Programming Help Needed Please

Donald Delmar Davis ddelmardavis at gmail.com
Tue Apr 28 02:53:15 EDT 2009


I got home an realized that I had a baggie full of caps for you.
....

On Apr 5, 2009, at 6:18 PM, Hans Lindauer wrote:

> P.S. If I keep my Benito plugged in after programming, the LED  
> closest to the USB jack goes on whenever I send MIDI to the unit.   
> If that helps at all.
>
> From: Donald Delmar Davis <ddelmardavis at gmail.com>
> To: "A discussion list for dorkbot-pdx (portland, or)" <dorkbotpdx-blabber at dorkbot.org 
> >
> Sent: Sunday, April 5, 2009 11:25:50 AM
> Subject: Re: [dorkbotpdx-blabber] (2nd try) Programming Help Needed  
> Please
>
> Hans,
>
> Since you are only passing the data through without processing it  
> you should intercept and retransmit the bytes in the serial  
> interrupt routine.
>
> In wiring_serial.c
>
> change
> 	unsigned char c = UDR0;
> to
> 	unsigned char c = UDR0;
> #ifdef WIRING_ECHO_SERIAL
> 	UDR0 = c; //write c back to the Usart Data Register for transmission.
> #endif
>
> and #define WIRING_ECHO_SERIAL=1 somewhere.
>
> To do it right you should class serial or create a new core, its a  
> bit invasive but its actually what you really want here.
>
> Don.
>
>
>
>
> On Apr 5, 2009, at 11:07 AM, Hans Lindauer wrote:
>
>> Let's try this again, without the attachments.  You can find them  
>> at the provided link.
>>
>> ----- Forwarded Message ----
>> From: Hans Lindauer <armatronix at sbcglobal.net>
>> To: dorkbotpdx-blabber at dorkbot.org
>> Sent: Sunday, April 5, 2009 10:41:47 AM
>> Subject: Programming Help Needed Please
>>
>> OK, I have (hopefully) one line to program to finish my re-write of  
>> my MIDI lights firmware.  It's the line that modifies the MIDI  
>> library so that it passes any incoming bytes to the THRU port.
>>
>> In my old program, I just did a Serial.read follower by a  
>> Serial.print, as follows:
>>
>> void loop () {
>>   if (Serial.available() > 0) {
>>     newbyte = Serial.read(); // read the incoming byte
>>     Serial.print(newbyte); // echo the incoming byte
>> ...
>>
>> I tried that again here, but with no luck.  Then I looked at how  
>> they send data to the serial port for MIDI OUT in the library, and  
>> saw that they use a slightly different syntax: serial_.print (b,  
>> TYPE).  So I tried adding that instead, as follows.  I've included  
>> an extra snippet that shows how they're doing it, for context.  My  
>> line is the one with the asterisks.  I assumed that I could ignore  
>> the type argument, since I'm just passing the (int) variable c  
>> straight thru.  (I also tried it as INT and BYTE types):
>>
>>
>> // Try to read data at serial port & pass anything read to  
>> processing function
>> void Midi::poll(void)
>> {
>>     int c;
>>
>>     // Just keep sucking data from serial port until it runs out,  
>> processing
>>     //  MIDI messages as we go
>>     while((c = serial_.read()) != -1) {
>>         recvByte(c);
>>         serial_.print(c); // ***** pass MIDI data THRU *****
>>     }
>> }
>>
>>
>> // Send Midi NOTE OFF message to a given channel, with note 0-127  
>> and velocity 0-127
>> void Midi::sendNoteOff(unsigned int channel, unsigned int note,  
>> unsigned int velocity)
>> {
>>     int status = STATUS_EVENT_NOTE_OFF | ((channel - 1) & 0x0f);
>>
>>     if (sendFullCommands_ || (lastStatusSent_ != status)) {
>>         serial_.print(status, BYTE);
>>     }
>>
>>     serial_.print(note & 0x7f, BYTE);
>>     serial_.print(velocity & 0x7f, BYTE);
>> }
>>
>>
>> If it helps to see the full library code from http://timothytwillman.com/?page_id=240 
>> , it's attached (this snippet is in midi.cpp).  Please let me know  
>> if you have any ideas.  By the way, this MIDI library seems to work  
>> pretty well otherwise (with only one light).
>>
>> Thanks,
>> -Hans
>> _______________________________________________
>> dorkbotpdx-blabber mailing list
>> dorkbotpdx-blabber at dorkbot.org
>> http://music.columbia.edu/mailman/listinfo/dorkbotpdx-blabber
>
> _______________________________________________
> dorkbotpdx-blabber mailing list
> dorkbotpdx-blabber at dorkbot.org
> http://music.columbia.edu/mailman/listinfo/dorkbotpdx-blabber

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://music.columbia.edu/pipermail/dorkbotpdx-blabber/attachments/20090427/1fa327ea/attachment.html


More information about the dorkbotpdx-blabber mailing list