7 embedded programming

I decided to use the language Arduino to program my “Hello Dan- 02″ board

w6

(you can found the references here: w6 – hello D-02 and the files in the bottom of this page)

the references that I used are:

arduino as isp_fab academy

arduino as isp_arduino

To do it, I had to charge ATtiny into the Arduino hardware folder, and then I checked in order to see if it appears.

Captura de pantalla 2015-06-25 a las 21.30.12

Captura de pantalla 2015-06-26 a las 1.47.28

then I selected Arduino as ISP and i charged the code

arduino isp

 

code a

… and the boot loader

uemando

After the bootloader I connected my Hello, putting before a 10UF capacitor in the “ground” and “reset” of my Arduino uno, to make sure the connection;

then I checked the connections ISP pines (for others boards is important to check the pins because they are different), and I connected my Hello.

slave reset     10
MOSI              11
MISO              12
SCK                 13

The next step is to select the microprocessor, in this case the ATtiny 44

a44

another thing to remember is if you are using the internal clock or the external; in my case I have a 20 mhz crystal

external clock

and I select it and then I make the bootloader

bootloader

the next step is run a code, I used an example from the basic library of Arduino called “Blink”, that has a loop to turn a led on and off.

Captura de pantalla 2015-06-25 a las 22.26.23

I did some small test to change the code

– at first I changed the delay and it works well

Captura de pantalla 2015-06-25 a las 22.51.46

Then I tried with this small change, that runs correctly, but at first was not working … the light was off.

I decided yo make this small change on the code, because for my final project I want to work by connecting lights with numbers and letters of the alphabet; this is a first simple test, just to see how to start with this association; here, you can take ON or OFF the light writing a letter, in this case ‘a’.

code daniela – blink modified

  1. /*
  2. BASE
  3. Blink
  4. Turns on an LED on for one second, then off for one second, repeatedly.
  5.  
  6. Most Arduinos have an on-board LED you can control. On the Uno and
  7. Leonardo, it is attached to digital pin 13. If you're unsure what
  8. pin the on-board LED is connected to on your Arduino model, check
  9. the documentation at http://arduino.cc
  10.  
  11. This example code is in the public domain.
  12.  
  13. modified 8 May 2014
  14. by Scott Fitzgerald
  15. MODIFIED BY DANIELA FROGHERI - FAB ACADEMY 2015
  16. */
  17.  
  18. char test = 'a';
  19.  
  20. // the setup function runs once when you press reset or power the board
  21. void setup() {
  22. // initialize digital pin 13 as an output.
  23. pinMode(1, OUTPUT);
  24. }
  25.  
  26.  
  27. // the loop function runs over and over again forever
  28. void loop()
  29. {
  30. if (test== 'a')
  31. {
  32. digitalWrite(13, HIGH); // turn the LED on if test is 'a'
  33. delay(500);
  34. }
  35.  
  36. else
  37. digitalWrite(13, LOW); // turn the LED off if test is not 'a'
  38. delay(100);
  39. {
  40.  
  41. }
  42.  
  43. }

Finally I discovered that it was a physical problem on my board… I burned the led!

I changed it putting a white led ( the first one was green) adding  a piece of conductive tape to weld well, because a part of my circuit was disconnected!

IMG_8526

Finally the hello Dan-02 is working.

hello apagado white

hello prendido white

This activity was very important for me, because I started to see how to connect a light that can be taken off or on with a letter on my code; my board is not so nice as the first one that I made … but I learned a lot;

This is not the only way, you can make this work also using the terminal and with your fab ISP or with a programmer as I did for the 4th week w4 – electronics production or for the 10 week w10 -input; here I decided to try with this option , because for me is the first step for my final proyect;

I learned a lot, about different things: physical ( in some moment I was thinking only about the code, but a physical part of my board was broken …), connections … the position of the connections … and of course the code, and the correct sequence in order of all the steps …

 

 


Files:

folder w7