WINKING LED CIRCUIT BOARD, PART II
This week I tried to understand embedded programming so that I could program the winking LED circuit board I made in Wk 5 - particularly the workflow from my brain to a winking LED on a circuit board when using different development environments.
Here's my sketch of the workflow process for the Arduino and C development environments - nice and simply laid out so you can understand what each component in the process does, and how the different environments wrap them up, and what programs you have to use/what you have to do at each of these steps:
HOW TO PROGRAM YOUR ATTINY CIRCUIT BOARD USING C PROGRAMMING WORKFLOW
I found Laia's tutorial very helpful in downloading all the right software, and Travis's page for the code to make it blink.
1: WRITE YOUR CODE Here is my C code and Makefile that I used to program my circuit board (see opposite) - I used a modified version of Neil's code with help from Travis. Here are some tips:
|
|
|
2: CONNECT EVERYTHING TOGETHER
|
Philippas-MacBook-Pro:Wk 7 - programming pip$ make -f blinking.led.c.make avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.00s avrdude: Device signature = 0x1e9207 Writing | ################################################## | 100% 0.00s avrdude: 1 bytes of lfuse written Reading | ################################################## | 100% 0.00s avrdude: verifying ... avrdude: safemode: Fuses OK avrdude done. Thank you. Philippas-MacBook-Pro:Wk 7 - programming pip$ sudo make -f blinking.led.c.make program-usbtiny avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.00s avrdude: Device signature = 0x1e9207 Writing | ################################################## | 100% 0.21 avrdude: 222 bytes of flash written Reading | ################################################## | 100% 0.13s avrdude: verifying ... avrdude: safemode: Fuses OK avrdude done. Thank you.
|
3: RUN THE MAKEFILE IN TERMINAL Here are the commands I used in Terminal to run the Makefile which takes my C code, compiles it using gcc, and uses avrdude to upload it to the FabISP:
|
|
4: BLINK YOUR LED! The code should now be loaded onto the chip on your circuit board now, so you can disconnect the FabISP from your circuit board. As I had two LEDs and one switch on my board, I wanted to program the 4 different combinations - both off, red LED on, green LED on, red and green LEDs on - to come on one after the other when you push the switch 4 times.
At the moment my code doesn't take into account the clock cycle in the chip, so pushing the switch gives you a bit of a random chance of which mode - none, red, green or both - that you'll get. |