"read a microcontroller data sheet
program your board to do something"
We built and ISP and a hello_echo board. This week, it was time to program the board with the ISP. I think this week is important.
The first step is to connect the hello_echo board through the ISP with a USB port on the laptop. To make sure the pins were connected correctly, I looked at the schematics of the FabTiny* and the hello_echo board:
Then, opened Arduino application on the laptop. This is an IDE for Arduino's. The FABTiny* is Arduino compatible, so you can use this IDE. One thing that needs to be done, is install a hardware library, so that the Arduino application knows how to talk to the FABTiny*.
This tutorial on High-Low Tech was very useful in getting this to work. It provides a link to this repository on Github that holds ATtiny library that Arduino needs. After downloading the file, you need to move it to a '../hardware' directory in the Arduino documents folder (it automatically creates it in ~/Documents).
After running Arduino, under Tools>Boards
, you will find an option for ATtiny. Here are te settings you need with the FABTiny*:
Make
and Makefiles
can be found here.int led_pin_1 = 7; void setup() { pinMode(led_pin_1, OUTPUT); } void loop() { digitalWrite(led_pin_1, HIGH); delay(2); digitalWrite(led_pin_1, LOW); delay(20); }
Yay! The LED is blinking.
note: What a great feeling to have built something, that controls something else that was also built by myself with a piece of code that I wrote. Yay!
Now it is time to experiment a little with the code. For instance, setting the LED to different intensities:
Controlling the LED with a button push. At first, the LED was operating inversely to my intention, untill I realized that the button pin is actually LOW when you push it :-).
After this I experimented a little with changing the LED blink speed with a push of the switch:
OK, so then things got interesting. I was witnessing fluctuations in my LED's intensity for no reason when I used this code:
analogWrite(led_pin, analogRead(button_pin));First, I thought it was the code. That was not it.
I managed to compile Neil's code from the terminal to the board. I will add pictures of that later.
Some other things I still want to do with the board: