IMPORTANT NOTE: The Teensy 3.5 will most likely be discontinued soon. "PJRC recommends use of Teensy 4.0 / 4.1 for new projects. We do not believe supply of chips for Teensy 3.x is likely to ever fully recover. These chips are made with 90 nm silicon process. Most of the world's semiconductor fabs are focusing on 45 nm or smaller, leaving limited supply for older chips. We anticipate the cost of these chips is likely to increase as the supply continues to dwindle." I recommend to only use this for personal projects.
This code allows you to use a Teensy 3.5 and a vectorscope (oscilloscope on X-Y-mode) as a vector display.
- Install the Arduino IDE and Teensyduino (Arduino IDE with Teensyduino for Arch based systems)
- Extract DrawVector and open DrawVector.ino in the Arduino IDE
- Make sure that the Teensy 3.5 is connected and select it and its serial port under the "Tools" tab in the Arduino IDE
- Hit the upload button and wait for the code to compile and upload
Connect the pin labeled "DAC0" to the vectorscope's "X"-channel and the pin labeled "DAC1" to the "Y"-Channel. Afterward, you have to connect the Teensy's ground with the vectorscope's ground. (Teensy 3.5 pinout)
Package Manager: Install-Package VectorOutput -Version 1.1.3
Create a global VectorOutput
variable:
private VectorOutput vOut;
Request the COM port of your Teensy and create a new VectorOutput
instance:
string? comPort = VectorOutput.ComPortForm();
while (comPort == null)
{
comPort = VectorOutput.ComPortForm();
}
try
{
vOut = new VectorOutput(comPort);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
Display an image:
vOut.Lines = new ushort[][] { new ushort[] { 0, 0, 0xFFF, 0xFFF } };
vOut.DrawFrame();
Note: Lines
is a jagged array of ushort arrays. The ushort arrays represent lines and always have a length of 4. The first two ushorts are the starting X and Y coordinates of the line, the last two are the ending X and Y. All coordinates have to be between 0 (bottom/left) and 4095/0xFFF (top/right).