PDA

View Full Version : teensy 3.1 as a GPIO extension



Roland
12-26-2013, 04:56 PM
Hi forum,
I just got my first teensy board, a teensy 3.1.

I do some robotics with linux and just want my "normal" CPU to be able to
interact with the real world.
I chose the teensy 3.1 because of the i2c bus and the 12 pwm channels.
I do not want to use the teeny cpu to do any kind of calculation,
I just want to use the GPIO ports from my linux programs.
The easiest way for me would be to plug in the teensy with
a USB cable, get a virtual serial device on my linux and
send commands like "port1=on" or "pwm7=90" (in %)
or "i2c send 0x100 0xFF 0x00" or "i2c read 0x100" or something like this.

Is there already a mode to use the teensy like this or a ready made
program providing this feature?

Thanks for your help!
Roland

Constantin
12-26-2013, 09:47 PM
Seems perfectly reasonable to use the teensy 3 in this fashion, especially if you use either the usb or one of the three hardware serial ports.

Look through the serial commands for inspiration. As for how to accept commands through serial, an obvious example I can think of is setting a ds3231, ds3107, etc real time clock from the command line. So have a look for that over at the arduino website.

Another example of parsing I can think of are the gps libraries that Paul includes with the teensy 3.