<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div>Let's try this again, without the attachments.&nbsp; You can find them at the provided link.<br></div><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><font size="2" face="Tahoma">----- Forwarded Message ----<br><b><span style="font-weight: bold;">From:</span></b> Hans Lindauer &lt;armatronix@sbcglobal.net&gt;<br><b><span style="font-weight: bold;">To:</span></b> dorkbotpdx-blabber@dorkbot.org<br><b><span style="font-weight: bold;">Sent:</span></b> Sunday, April 5, 2009 10:41:47 AM<br><b><span style="font-weight: bold;">Subject:</span></b> Programming Help Needed Please<br></font><br>
<div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">
<div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><div>OK, I have (hopefully) one line to program to finish my re-write of my MIDI lights firmware.&nbsp; It's the line that modifies the MIDI library so that it passes any incoming bytes to the THRU port.<br><br>In my old program, I just did a Serial.read follower by a Serial.print, as follows:<br><br>void loop () {<br>&nbsp; if (Serial.available() &gt; 0) {<br>&nbsp;&nbsp;&nbsp; newbyte = Serial.read(); // read the incoming byte<br>&nbsp;&nbsp;&nbsp; Serial.print(newbyte); // echo the incoming byte<br>...<br><br>I tried that again here, but with no luck.&nbsp; 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).&nbsp; So I tried adding that instead, as follows.&nbsp; I've included an extra snippet that shows how they're doing it, for context.&nbsp; My line is the one
 with the asterisks.&nbsp; I assumed that I could ignore the type argument, since I'm just passing the (int) variable c straight thru.&nbsp; (I also tried it as INT and BYTE types):<br><br><br>// Try to read data at serial port &amp; pass anything read to processing function<br>void Midi::poll(void)<br>{<br>&nbsp;&nbsp;&nbsp; int c;<br><br>&nbsp;&nbsp;&nbsp; // Just keep sucking data from serial port until it runs out, processing<br>&nbsp;&nbsp;&nbsp; //&nbsp; MIDI messages as we go<br>&nbsp;&nbsp;&nbsp; while((c = serial_.read()) != -1) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; recvByte(c);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; serial_.print(c); // ***** pass MIDI data THRU *****<br>&nbsp;&nbsp;&nbsp; }<br>}<br><br><br>// Send Midi NOTE OFF message to a given channel, with note 0-127 and velocity 0-127<br>void Midi::sendNoteOff(unsigned int channel, unsigned int note, unsigned int velocity)<br>{<br>&nbsp;&nbsp;&nbsp; int status =
 STATUS_EVENT_NOTE_OFF | ((channel - 1) &amp; 0x0f);<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; if (sendFullCommands_ || (lastStatusSent_ != status)) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; serial_.print(status, BYTE);<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; serial_.print(note &amp; 0x7f, BYTE);<br>&nbsp;&nbsp;&nbsp; serial_.print(velocity &amp; 0x7f, BYTE);<br>}<br><br><br><span>If it helps to see the full library code from <a target="_blank" href="http://timothytwillman.com/?page_id=240">http://timothytwillman.com/?page_id=240</a>, it's attached (this snippet is in midi.cpp).&nbsp; Please let me know if you have any ideas.&nbsp; By the way, this MIDI library seems to work pretty well otherwise (with only one light).</span><br><br>Thanks,<br>-Hans<br></div></div></div></div></div></div></body></html>