Assignment: how to program my board.
The aim of this assignment is to program the board we have drawn. My board is a Hello World Board with a pushbutton and a led. This has been a real challenge for me.
I followed the Providence tutorial embedded_programming_arduinoIDE.html to program my board.
- 1 Download the Arduino 1.0 software
- 2 Download and install the ATtiny Board Files.
I installed the Arduino 1.0 software for Mac, as well as the ATtiny44 Board files. However, my FabISP and Hello World Board were not recognized by my computer.
I did some others attempts on my Mac, and even a try on a pc in which the FabISP was recognized as an "Unknown Device". When I checked device properties, a message warned me that "No drivers are installed for this device" so I tried to install them manually, but it didn't work again!
I spent some time checking the soldering points and the connections, and so I finally managed to make the ISP working! Unfortunately, some minutes later the USB port felt apart from ISP board, so I had to make it again. The new ISP board just worked "out of the box".
I still do not know why my FabISP was not working in the first moment, I can only assume that there was a manufacturing problem. But, at least, I made it.
I’ve started my trials sending to the board the sample sketch in the Tutorial.
const int buttonPin = 3;
const int ledPin = 8;
// variables will change:
int buttonState = 0;
//In the setup I said to the microcontroller that the button=3 is used as input and that the ledPin=8 is used as an output.
SETUP
void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
}
//Then in the loop, I said to read the logic value of the pin 3 with the command digitalRead. The value is 0 when the button is notpressed or 1 when is pressed. With if statement I checked the value and I turned on or off the led according to it using the digitalWrite command.
void loop() {
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if (buttonState == HIGH) {
// turn LED on:
digitalWrite(ledPin, HIGH);
}
else {
// turn LED off:
digitalWrite(ledPin, LOW);
}
}