Project tutorial
Teensy Setup and Debugging

Teensy Setup and Debugging © GPL3+

Get your Teensy Setup for Arduino, and start using the Serial debugger in Visual Micro straight away to solve those last few code issues....

  • 2,741 views
  • 0 comments
  • 2 respects

Components and supplies

Teensy36
Teensy 3.6
(Or any Teensy Board)
×1

Apps and online services

About this project

Installing the Teensy boards isn't available via boards manager at the moment, and the below guide will get you setup in minutes.

Once we're setup we can get some code uploaded, and use some Debugging Tools to help us with our Arduino project development in Visual Studio with Visual Micro.

Software Setup

We assume that you have already installed the Arduino IDE on your machine (if not download here).

Adding the Teensyduino components:-

Download the Windows package from PJRC here

Run the Installer and follow the on-screen prompts (also captioned below), ensuring you install it into the same Arduino IDE location you are using in Visual Micro:

This is all that's needed to make the Teensy boards and tools available to Arduino, and Visual Micro.

Hardware Setup

Just connect your Teensy board to your PC using the USB cable provided, any drivers needed were installed by the installer in the previous step.

Lets Code

Now we can get our first sketch uploaded onto our board;-

Open an existing or New project in Visual Micro

Select the boards list and locate your Teensy of choice.

Ensure on the Board Options the the "USB Type: Serial" option is set.

Now simply Build & Upload the code to your board

NOTE - you will see a window pop up during the process whichwill perform the upload. Once this is done this window can be closed.

Thats it! Your code should now have been uploaded to your board.

Debugging the Code

The next challenge to simplify, is what to do when you have a problem with your program which you cant figure out... this is where the Serial Debugger allows you to monitor your code closely and control its execution as it runs...

Here we will need to select the "Debug: Serial" mode in Visual Micro

Then add Breakpoints where you want to stop in your code, by clicking in the left margin (more breakpoint help).

You can also trace variables by setting Actions when a breakpoint is hit.

Simply Build and Upload and the Serial Debugger will start automatically.

NOTE - If you change breakpoint positions or actions then the sketch will need to be re-uploaded to the board

Now you have your board debugging and working, you can also calibrate sensors, and plot graphs of your data / readings with literally only a few steps, using the Serial Debugger.

Full Video Walkthrough

Hopefullyitallmadesense,but having a video to follow through is always useful:

A Video Walkthrough of this guide

Find Out More

Visual Micro Website

Serial Debugger Walkthrough

PJRC Website

Code

Projectname.inoArduino
Main Sketch file for project to try with Teensy (just to demonstrate debugger and upload functionality)
byte state = 0;
long counter = 0;

// the setup function runs once when you press reset or power the board
void setup() {

	Serial.begin(115200);
	pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again until power down or reset
void loop() {
	Serial.println("Loop()");
	digitalWrite(LED_BUILTIN, state);
	counter++;
	state = sumOf(state, 1); // Function in another INO
	state = state % 2;
	delay(1000);
}
Calcs.inoArduino
Secondary Sketch file for project to try with Teensy (just to demonstrate debugger and upload functionality)
int sumOf(int a, int b) {
	int c = a + b;
	return c;

}

Schematics

Teensyduino Board
Teensy36 zmpyyst0of

Comments

Similar projects you might like

Arduino Uno Debugging

Project tutorial by visualmicro

  • 950 views
  • 0 comments
  • 5 respects

Arduino Nano 33 IoT Debugging

Project tutorial by visualmicro

  • 3,255 views
  • 3 comments
  • 12 respects

Arduino Nano 33 BLE/IoT Custom Debugging

Project tutorial by visualmicro

  • 1,043 views
  • 0 comments
  • 4 respects

SerialDebug: Improving Debug to Arduino

Project tutorial by JoaoLopesF

  • 5,031 views
  • 7 comments
  • 31 respects

Standard Embedded Arduino Nano Setup

Project tutorial by Jeremy S. Cook

  • 3,253 views
  • 1 comment
  • 21 respects

Line Follower Robot - PID Control - Android Setup

Project tutorial by MJRoBot

  • 36,286 views
  • 10 comments
  • 46 respects
Add projectSign up / Login