Uploading Arduino Sketches to the Teensy 3.1 from the Terminal
First, install Arduino 1.6.1 from http://arduino.cc/en/Main/Software. I followed the Mac OS X for Java 6 link to download arduino-1.6.1-macosx.zip
. Install Arduino by unzipping the Arduino
file and moving it to /Applications/Arduino
. Open Arduino to make sure it works and so it can finish setting up the environment for use. Next, install Teensyduino 1.21 from https://www.pjrc.com/teensy/td_download.html. I followed Macintosh OS-X Installer to download teensyduino.dmg
. Open and proceed through the Teensyduino installer, and when prompted to locate Arduino, select /Applications/Arduino
, then continue to the next step in the installer.
At this point, you should be ready to upload a sketch. Follow the instructions below.
To upload from the terminal, enter the following command:
/Applications/Arduino.app/Contents/MacOS/JavaApplicationStub --board teensy:avr:teensy31 --port /dev/tty.usbmodem573061 --upload /Users/mokogobo/Checkouts/pixel/Firmware/Pixel_Firmware/Pixel_Firmware.ino --pref custom_speed=teensy31_96opt
To monitor the serial output from the Arduino, enter the command:
screen /dev/tty.usbmodem573061 115200
To exit screen
enter the command Control + A
then Control + /
. You may need to press Return
to see the terminal prompt again.
Notes
The above commands make the following assumptions:
- Arduino 1.6.1 has been installed to
/Applications/Arduino
. - The Teensy 3.1 device appears as
/dev/tty.usbmodem573061
. Correct this for your device. List available USB devices by entering the commandls /dev/tty.usb*
. You may also find this in the Arduino application in the Tools > Port menu. - The full path to the main .ino sketch is
/Users/mokogobo/Sandbox/Checkouts/pixel/Firmware/Pixel_Firmware/Pixel_Firmware.ino
. Set this to the full path of your sketch. - The serial output is set to 115200 baud. That is, the Arduino sketch calls
Serial.begin (115200);
. Change this as needed.
Resources