program your board to do something
Two weeks ago I programmed my board with Arduino, so the setup is ready to start adding code through Arduino.
The essential infomration we need to know to start with, is how to refer to each pin of the microprocessor with Arduino. Image below:
![](https://i.imgur.com/l7fHZTJ.png)
Blink
I begun opening the Blink example from the Arduino library. I found the code quite easy to understand, so I simply had to identify which pins from the microcontroller belonged to any of the LED's and see the converversion for Arduino. After this I replaced the code with my pin number.
![](http://fab.academany.org/2018/labs/barcelona/students/marta-bocos/img/8a_Arduino_blink.jpg)
Serial
I wanted to test the Serial Example witm my board as I wanted to understand how it works. Serial is used to send information to another divice, in my cause, my laptop, it is done through the TX and RX pins (one sends info, the other receives it). I downloaded the Software Serial library instead of the Serial because the ATtiny doesn't have as much memory as the Ardunio and it can't handle the information required for Serial, so Software Serial was created for smaller microprocessors.
I tweaked the default Arduino example with my pins to make it write the word "hello" everytime I press the button. To test the receiving information functionality, I made it so that everytime I write something on the console, the LED blinks on and off.
My Board
The outputs my board has were two LED's and a button. I decided to make the Red LED to be permanently on, it would only be turned off if the button was pushed, which would turn the green LED on.
In order to do this I got the "Button" example from the Arduino examples library. Doing so, let me understand how to reffer to the button and to give it instructions. After replacing the example with the pins on my board I only had to add the extra LED, and set it to always be HIGH, unless the button was pushed, then its position would be on LOW.
![](http://fab.academany.org/2018/labs/barcelona/students/marta-bocos/img/8c_Arduino_MartaButton.jpg)
I found it really useful to always have the Eagle files of the board open as well as the microcontroller-arduino conversion diagram.
Files:
Blink(.ino)
SoftwareSerial(.ino)
Button-Marta(.ino)