»
«


While debugging our new SerialUSB implementation I needed to use the regular Serial2 interface to track down ASSERT failures, but couldn’t find a spare FTDI chip around the lab. I’ve got one of these super slick little ones in the mail, but in the meanwhile I wrote this sketch in about 2 seconds which turns a spare Maple into a Serial-USB passthrough:

void setup() {
  Serial2.begin(9600);
}

void loop() {
  if(SerialUSB.available()) {
    Serial2.write(SerialUSB.read());
  }
  if(Serial2.available()) {
    SerialUSB.write(Serial2.read());
  }
}

There are a million better ways to do this but I love how easy this was!


This entry was posted by bnewbold on Sunday, July 18th, 2010 at 10:20 am. You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.

Leave a Reply




Contact webmaster@leaflabs.com with website issues

Powered by WordPress, nginx, Linux, vim, and coffee.

This site intended to be valid HTML 4.01 Strict. Best viewed with any standards-compliant browser.

Copyright LeafLabs LLC, 2009-2010, a member of the
Green Street Space.
Unless otherwise noted all content on this website is released under the Creative Commons Attribution Licence 3.0

Hello Anonymous! Login?