Week 9

Embedded Programming

Assignment

Individual assignment:
Read a microcontroller data sheet program your board to do something, with as many different programming languages and programming environments as possible
Group assignment:
Compare the performance and development workflows for other architectures

Files

Button2

Arduino

We were practicing with Arduino. We connected everything with wires and made instructions in the Arduino so the tiny bulb would blink. This was an easy exercise because you could see when you did something wrong, the bulb wouldn’t light up. I only had some troubles with turning the legs on the bulb the right way. You could tell the Arduino how long the break between the blinks should be, and how long time the blinks should last.
We tried with adding a buzzer and found some funny melodies on the internet. The buzzer is vibrating and depending on how much it is vibrating, it is making different tones. Then you can change how long time the break between the buzzes were going to be and for how long time it should be buzzing.




Arduino coding

Arduino tutorial for the board:
http://highlowtech.org/?p=1695

To get the ATtiny's on arduino I needed to download this link to the boards manager URLs: https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json
After this, go into Tools-> Board. Find the ATtiny and select it. Install it on the button.
Now you should be able to find the ATtiny under Tools-> Board-> ATtiny.
This is also shown in the tutorial above I followed.

I'm using my USBtinyISP as a progrogrammer.
Now I have to choose the correct things (also shown in the pictures below).
Under Tools-> Board choose the ATtiny24/44/84 because I have an ATtiny44 on my button.
Next under Tools-> Processor choose the ATtiny44.
And last I have to choose which programmer I'm using. Under Tools-> Programmer choose the USBtinyISP.



Blink

Now to make the button blink.
At first I burn the bootloader. I go to tools and choose burn bootloader. This will delete any plausible data that the button might have before.

Then I will open the Blink from examples. If I run the blink setting it can't figure it out. This is because it is set to the wrong pin. First I will figure out which pin is connected to the LED by looking at a picture of the ATtiny44.



I find out that it is on pin 7. In Arduino we then have to write: int LED = PA7;
This is saying that everything named LED is talking to pin 7

then I can change the delay of how long time the LED should be turned on and how long time the LED should be turned off.





I just tried with another code that should turn the LED off when I pushed the button. This worked (see video bellow).