Tuesday, February 7, 2012

Tutorials




I have now completed the Teensy Tutorials 1 through 4.

Tutorial 1 configures all the software and downloads a program using the usb connector. This program lights the onboard led.

Then Tutorial 2 lights 3 leds in a timed sequence. Then loads a program that varies the intensity of the 3 leds slowly making them brighter then dimmer. Rather clever I thought.

Tutorial 3 adds two pushbuttons which allows further control of how the leds light. On pushbutton uses a pull-up resistor while the second pushbutton is configured by the code to use a built in pull-up resistor.

Tutorial 4 adds a 10k variable resistor and reads its output to the Sketch programs Serial Output screen. I was able to configure an LM34 temperature chip on the breadboard and read its output to the Serial Output screen. I used some math to enable it to read in Fahrenheit. (5v/1023 = 0.0049; then 0.0049 * 100 provided the actual Fahrenheit reading. The 1023 is the number of divisions the analog to digital converter in the Teensy uses.) (The LM34 outputs 10mv/degree.)



All the tutorials seemed to go quite smoothly. Good instructions.

Tuesday, January 24, 2012

First program on microcontroller.

First I was able to load and run a simple code.

Then I modified the code some to run 4 led's with simple delays to turn off or on the next light. this just lets me know I am able to write a program and load it into the controller. The following picture shows the Arduino software I use to load the program to the Teensy Microcontroller. I inserted the actual code next.

_____________________________

/* RGB LED Blink, Teensyduino Tutorial #2
http://www.pjrc.com/teensy/tutorial2.html

This example code is in the public domain. Jim's info - for teensy 2.0. Will blink each light for 400 ms
*/

const int builtinPin = 11;
const int yellowPin = 12;
const int redPin = 14;
const int greenPin = 15;

// The setup() method runs once, when the sketch starts

void setup() {
// initialize the digitals pin as an outputs
pinMode(builtinPin, OUTPUT);
pinMode(yellowPin, OUTPUT);
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
}

// the loop() method runs over and over again,

void loop()
{
digitalWrite(builtinPin, HIGH);
delay(1000);
digitalWrite(yellowPin, HIGH);
delay(1000);
digitalWrite(redPin, HIGH);
delay(1000);
digitalWrite(greenPin, HIGH);
delay(2000);
digitalWrite(builtinPin, LOW);
delay(1000);
digitalWrite(yellowPin, LOW);
delay(1000);
digitalWrite(redPin, LOW);
delay(1000);
digitalWrite(greenPin, LOW);

delay(2000);
}

___________________________________________

The following is a video of the actual output.