wiki:ArduinomeSerial
Last modified 8 years ago Last modified on 07/07/09 13:51:07

Arduinome Serial (with LCD Support)

A customised version of the arduinome serial router with support for sending lcd message strings via osc.

Download

Windows

OS X

Protocol

LCD messages are accepted via OSC in the format

/prefix/lcd string

The router then outputs the following 3 byte serial message, 1 message per character:

iiiixxxx aaaaaaaa bbbbbbbb
i = address (15)
a = character location id
b = character value

For example /prefix/lcd "Hello World" becomes:

240 0 72
240 1 101
240 2 108
240 3 108
240 4 111

240 5 32

240 6 87
240 7 111
240 8 114
240 9 108
240 10 100

A string the length of the display defined in the firmware must be sent in order for the display to be updated

Key code for implementation

The exact same code is used in both the windows and mac versions of the router, however the location of this code differs slightly

source/appsource/applicationcontroller.cpp

void ApplicationController::handleOscMessage(const osc::ReceivedMessage &recmsg)

   else if (suffix == kOscDefaultAddrPatternLCDSuffix) {  /* prefix/lcd  -- added by ST8 */
       if (!stream.typetagMatch(kOscDefaultTypeTagsLCD))
           return;  
       string temp = stream.getString();
       const string& text = temp;
             for (i = matchingDevices.begin(); i != matchingDevices.end(); i++)
           (*i)->oscLCDEvent(text);      } 

source/serial/message.cc

void messagePackLCD(t_3b_message *message, uint8 addr, uint8 ch)
{
   message->data0 = kMessageTypeLCD << 4;
   message->data1 = (uint8)addr;
   message->data2 = (uint8)ch;
}

source/serial/MonomeXXDevice.cc

MonomeXXhDevice::oscLCDEvent(const string& text)
{
   t_3b_message message;

   for (int i = 0; i < text.length(); i++) {
       messagePackLCD(&message, i, text.at(i));

       write((char *)&message, sizeof(t_3b_message));
   }

}

Attachments