11 -

Output devices

The goal of this assignment is add an output device to a microcontroller board you've designed and program it to do something. I re-designed the board from last week (input devices), and added power, tx, rx leds to my design.

scheme

board

Milling and sodering

Coding

Uploading code by using FabISP and Arduino IDE, here are the settings:

The 1st Exercise

I tried a very simple code to test LED output. Based on pin definition:

 

void setup() {
}

void loop() {
digitalWrite(3, HIGH);
}

The 2nd Exercise

For my final project, I should try to connect servo motors to the output board. However when i tried to use Arduino IDE example there were some error messages.

Problems

Servo Library in Arduino IDE dose not support ATtiny45. Servo Library relies on haveing a 16-bit timer, but ATtiny 45 (or 85) has 2 8-bit timers. (some discussions on Arduino forum).

So I searched, and I found that developer Matthew has changed the code of Servo Library and shared his documentation on his site (http://projectsfromtech.blogspot.tw/2013/03/attiny85-servo-softwareservo-library.html), 8 bit servo library Software Servo.

ATtiny is run at 1 MHz. Since I want to use SoftwareServo library, I have to change Arduino IDE setting to let ATtiny45 run at 8 MHz (internal).

Tools > Clock > 8 MHz (internal)

 

Video

source file:

week_11_OutputDevices

:)