Fab Academy 2015, Dong-Hyun Kim

Output devices

Make an Output device (LED Array)


I decide to make LED Array which I found from Fab Academy Archive because it is similar with the LED Matrix for my final project “Open Bicycle”.
I really work hard on this I soldered 40 resistance and 40 LEDs one by one.
ha… tough life..

Success on “Boot loading”

Hooked up with Power supply, every single LED is work well!


1, 3, 20! Every LED work in order! Now the thing I have is program it suit with my Final Project.

Change the code

I’d like to change the code for showing LED light arrow. So, I opened C code with Notepad++.

//
//
// hello.array.44.c
//
// Charlieplex LED array hello-world
//
// Neil Gershenfeld
// 11/13/10
//
// (c) Massachusetts Institute of Technology 2010
// This work may be reproduced, modified, distributed,
// performed, and displayed for any purpose. Copyright is
// retained and must be preserved. The work is provided
// as is; no warranty is provided, and users accept all
// liability.
//

#include <avr/io.h>
#include <util/delay.h>

#define output(directions,pin) (directions |= pin) // set port direction for output
#define input(directions,pin) (directions &= (~pin)) // set port direction for input
#define set(port,pin) (port |= pin) // set port pin
#define clear(port,pin) (port &= (~pin)) // clear port pin
#define pin_test(pins,pin) (pins & pin) // test for port pin
#define bit_test(byte,bit) (byte & (1 << bit)) // test for bit set

#define led_delay() _delay_ms(1) // LED delay

#define led_port PORTA
#define led_direction DDRA

#define A (1 << PA1) // row 1
#define B (1 << PA2) // row 2
#define C (1 << PA3) // row 3
#define D (1 << PA4) // row 4
#define E (1 << PA5) // row 5

void flash(uint8_t from, uint8_t to, uint8_t delay) {
//
// source from, sink to, flash
//
static uint8_t i;
set(led_port,from);
clear(led_port,to);
output(led_direction,from);
output(led_direction,to);
for (i = 0; i < delay; ++i)
led_delay();
input(led_direction,from);
input(led_direction,to);
}

void led_cycle1(uint8_t number, uint8_t delay) {
//
// cycle through LEDs
//
uint8_t i;
for (i = 0; i < number; ++i) {
//flash(B,A,delay);
//flash(C,A,delay);
//flash(D,A,delay);
flash(E,A,delay);
//flash(A,B,delay);
//flash(C,B,delay);
flash(D,B,delay);
//flash(E,B,delay);
//flash(A,C,delay);
flash(B,C,delay);
//flash(D,C,delay);
//flash(E,C,delay);
//flash(A,D,delay);
//flash(B,D,delay);
flash(C,D,delay);
//flash(E,D,delay);
//flash(A,E,delay);
//flash(B,E,delay);
//flash(C,E,delay);
flash(D,E,delay);
}
}

void led_cycle2(uint8_t number, uint8_t delay) {
//
// cycle through LEDs
//
uint8_t i;
for (i = 0; i < number; ++i) {
//flash(B,A,delay);
//flash(C,A,delay);
flash(D,A,delay);
//flash(E,A,delay);
//flash(A,B,delay);
flash(C,B,delay);
//flash(D,B,delay);
//flash(E,B,delay);
flash(A,C,delay);
//flash(B,C,delay);
//flash(D,C,delay);
//flash(E,C,delay);
//flash(A,D,delay);
flash(B,D,delay);
//flash(C,D,delay);
//flash(E,D,delay);
//flash(A,E,delay);
//flash(B,E,delay);
flash(C,E,delay);
//flash(D,E,delay);
}
}

void led_cycle3(uint8_t number, uint8_t delay) {
//
// cycle through LEDs
//
uint8_t i;
for (i = 0; i < number; ++i) {
//flash(B,A,delay);
flash(C,A,delay);
//flash(D,A,delay);
//flash(E,A,delay);
flash(A,B,delay);
//flash(C,B,delay);
//flash(D,B,delay);
//flash(E,B,delay);
//flash(A,C,delay);
//flash(B,C,delay);
//flash(D,C,delay);
flash(E,C,delay);
flash(A,D,delay);
//flash(B,D,delay);
//flash(C,D,delay);
//flash(E,D,delay);
//flash(A,E,delay);
flash(B,E,delay);
//flash(C,E,delay);
//flash(D,E,delay);
}
}

void led_cycle4(uint8_t number, uint8_t delay) {
//
// cycle through LEDs
//
uint8_t i;
for (i = 0; i < number; ++i) {
flash(B,A,delay);
//flash(C,A,delay);
//flash(D,A,delay);
//flash(E,A,delay);
//flash(A,B,delay);
//flash(C,B,delay);
//flash(D,B,delay);
flash(E,B,delay);
//flash(A,C,delay);
//flash(B,C,delay);
flash(D,C,delay);
//flash(E,C,delay);
//flash(A,D,delay);
//flash(B,D,delay);
//flash(C,D,delay);
flash(E,D,delay);
flash(A,E,delay);
//flash(B,E,delay);
//flash(C,E,delay);
//flash(D,E,delay);
}
}

int main(void) {
//
// set clock divider to /1
//
CLKPR = (1 << CLKPCE);
CLKPR = (0 << CLKPS3) | (0 << CLKPS2) | (0 << CLKPS1) | (0 << CLKPS0);
//
// main loop
//
while (1) {
led_cycle1(10,5);
led_cycle2(10,5);
led_cycle3(10,5);
led_cycle4(10,5);
//led_cycle(1,100); // going through the arrary 1 time with a delay of 100
//led_cycle(3,20); // going through the arrary 3 times with a delay of 20
//led_cycle(100,1); // going through the arrary 100 times with a delay of 1
}
}

I modified Neil’s code. I separate cycle1, 2, 3, 4 and draw each sign.
Then I can see the movement of arrow to the left.

But there are some problems. It signed me that I couldn’t find hello.array.44.make file.


When I did upload on CMD, it couldn’t upload c file to LED array board.


Because, when I download c file on the internet, that would be text file, so I have to download with ‘save as the link’. And then I can download *.make file.


Then It works.

Redesign a board (LED array 5*6 for arduino)


I just redesigned a LED array(5 x 6) board for arduino.

Redesign a board (Speaker)


To redesign the board I decide to make the other output for my final project “Speaker”. I redesign the board and make it compact.

Download files

LED array (regesign)
LED array (code)

Makers Gonna Make !