Warning: Table './lockneyn_dorkbotpdx/cache_page' is marked as crashed and should be repaired query: SELECT data, created, headers, expire FROM cache_page WHERE cid = 'http://dorkbotpdx.org/blog/paul/teensy_as_a_benito' in /home/lockneyn/public_html/dorkbotpdx/includes/database.mysql.inc on line 172

Warning: Cannot modify header information - headers already sent by (output started at /home/lockneyn/public_html/dorkbotpdx/includes/database.mysql.inc:172) in /home/lockneyn/public_html/dorkbotpdx/includes/bootstrap.inc on line 488

Warning: Cannot modify header information - headers already sent by (output started at /home/lockneyn/public_html/dorkbotpdx/includes/database.mysql.inc:172) in /home/lockneyn/public_html/dorkbotpdx/includes/bootstrap.inc on line 489

Warning: Cannot modify header information - headers already sent by (output started at /home/lockneyn/public_html/dorkbotpdx/includes/database.mysql.inc:172) in /home/lockneyn/public_html/dorkbotpdx/includes/bootstrap.inc on line 490

Warning: Cannot modify header information - headers already sent by (output started at /home/lockneyn/public_html/dorkbotpdx/includes/database.mysql.inc:172) in /home/lockneyn/public_html/dorkbotpdx/includes/bootstrap.inc on line 491
Teensy as a Benito | DorkbotPDX

Teensy as a Benito

I released a new version of Teensyduino today, which adds USB-serial extensions to the Arduino Serial object. Now it's possible to use the Teensy via the Arduino IDE for in sorts of new ways.

For example, the Teensy can be programmed to work as a Benito.

Here is the simple sketch that makes it work.....


#define RESET_PIN 4
unsigned long baud = 19200;
HardwareSerial Uart = HardwareSerial();

void setup()
{
        digitalWrite(RESET_PIN, HIGH);
        pinMode(RESET_PIN, OUTPUT);
        Serial.begin(baud);   // USB, communication to PC or Mac
        Uart.begin(baud);  // UART, communication to Dorkboard
}

void loop()
{
        unsigned char c, dtr;
        static unsigned char prev_dtr = 0;

        if (Serial.baud() != baud) {
                baud = Serial.baud();
                Uart.begin(baud);
        }
        if (Serial.available()) {
                c = Serial.read();
                Uart.write(c);
        }
        if (Uart.available()) {
                c = Uart.read();
                Serial.write(c);
        }
        dtr = Serial.dtr();
        if (dtr && !prev_dtr) {
                digitalWrite(RESET_PIN, LOW);
                delay(1);
                digitalWrite(RESET_PIN, HIGH);
        }
        prev_dtr = dtr;
}


It's also possible to use this on a real Benito board. Here is a link to the HEX file, which can be loaded onto a Benito using the "DFU Loader".

http://www.pjrc.com/teensy/Teensy_Benito.hex

Comments

New version, with 57600 baud workaround

This code has been updated. Please use the new version:

http://dorkbotpdx.org/blog/paul/teensy_as_benito_at_57600_baud