The hardware is simple: An RC network (R, 20 kohms; C, 0.1 microfarad) is connected from pin 5 to ground to the X channel of the scope. An identical RC network is connected on pin 6 to ground to the Y channel.
The code is so short and simple I've pasted it here.
/* Oscilloscope Christmas Tree * * Created: Dec 10, 2011 * * Author: John M. De Cristofaro * Ported to Netduino by David Moisan, Dec. 19th, 2011 * * License: This code CC-BY-SA 3.0 and is unsupported. * (see creativecommons.org/licenses for info) * */ //Using using System; using System.Net; using System.Net.Sockets; using System.Threading; using Microsoft.SPOT; using Microsoft.SPOT.Hardware; using SecretLabs.NETMF.Hardware; using SecretLabs.NETMF.Hardware.NetduinoPlus; namespace ChristmasTree { public class Program { // Static PWM objects, one for each axis, X on D5, Y on D6 static PWM Xaxis = new PWM(Pins.GPIO_PIN_D5); static PWM Yaxis = new PWM(Pins.GPIO_PIN_D6); // ****** Code ******* void setup() { // Any setup code goes here } public static void Main() // Draw Tree and other elements here { while (true) { DrawTree(); // Christmas Tree // Nothing else yet } } static void DrawTree() { // Contains X,Y coordinates for Christmas Tree shape // Passes coordinates to generic drawing routine // Static consts const int NUM_POINTS = 19; // our tree is defined by 19 x/y coord. pairs // x coords uint[] Xpoints = new uint[NUM_POINTS] { 43, 43, 20, 32, 26, 38, 32, 43, 38, 49, 61, 55, 67, 61, 73, 67, 79, 55, 55 }; // y coords uint[] Ypoints = new uint[NUM_POINTS] {6, 14, 14, 34, 34, 53, 53, 73, 73, 92, 73, 73, 53, 53, 34, 34, 14, 14, 6 }; MakeTrace(Xpoints, Ypoints, NUM_POINTS); } static void MakeTrace(uint[] Xpoints, uint[] Ypoints, int Size) { // Generic drawing routine. Accepts two arrays of uint, one representing X coords, // one representing Y coords, and a uint size which applies to both arrays const int TRACE_DELAY = 1; // trace delay in mS. making this longer will // result in a straighter drawing, but slower // refresh rate. making it too short will result // in an angular blob. int t; for (t = 0; t < Size; t++) // run through the points in x & y { Debug.Print("MakeTrace t: "+ t + "x:" + Xpoints[t] + " y:" + Ypoints[t]); Xaxis.SetDutyCycle(Xpoints[t]); // Set X Yaxis.SetDutyCycle(Ypoints[t]); // Set Y Thread.Sleep(TRACE_DELAY); // wait TRACE_DELAY microseconds } } } }
I refactored John's original code because I figured I could have multiple sequential displays one after another but didn't have time to play further. I'm also aware that I'm wasting the capabilities of the Plus. I'm not sure you could display much vector text and have it look good, but that would be next thing to try.
I've attached a picture.