I built a new Website and launched it two weeks ago, took about a month to build. I built it all in Ruby on Rails. it was my first RoR project. the design started out with square boxes for the rating system and decided to keep the square theme through out the website.
Arduino + Winamp charlieplexed 6X5
by Dave Johnson
Ardor from arduino.cc posted a question about simplifying his charlieplexed code, and I didn’t have a straight answer for him because I haven’t charlieplexed before. So in order to solve this I built myself a 6×5 led array using 6 wires. I pretty much copied Andrew Magill’s design on everything except I’m using an Arduino.
so my answer for simplifying the code was two arrays… one that would store the led location and one that would decide whether to turn it on or off. once i had that figured out then i just mixed in my code for processing the winamp data and that was it. the hardest part was trying to get a 950 micro second delay working.. on all my previous projects this wasn’t hard but for some reason this one put up a fight.
I’ll be working on a detailed tutorial later on this week.
/*
--- Arduino + Winamp charlieplexed
--- Copyright 2011 - Dave Johnson
--- Dave@SilverCG.com - www.SilverCG.com
*/
#include
#define A 0 // index number of pins[] array
#define B 1
#define C 2
#define D 3
#define E 4
#define F 5
#define NUMBER_OF_PINS 6
byte pins[] = {5,6,7,8,9,10}; // arduino pins
Charlieplex plex = Charlieplex(pins,NUMBER_OF_PINS);
long previousMillis = 0;
long interval = 950; //micro second delay
int j = 0;
int i = 0;
int data[10];
//array of all leds,
int c[5][6][2] =
{
{ {F, A}, {E, A}, {D, A}, {C, A}, {B, A}, {A, B} },
{ {F, B}, {E, B}, {D, B}, {C, B}, {B, C}, {A, C} },
{ {F, C}, {E, C}, {D, C}, {C, D}, {B, D}, {A, D} },
{ {F, D}, {E, D}, {D, E}, {C, E}, {B, E}, {A, E} },
{ {F, E}, {E, F}, {D, F}, {C, F}, {B, F}, {A, F} },
};
void setup()
{
Serial.begin(57600);
}
void loop()
{
int full[35];
int divide = 2;
float total;
if (Serial.available() > 10) {
byte x = Serial.read();
if (int(x) == 255) {
for (int h = 0; h <= 9; h++){
data[h] = int(Serial.read());
}
}
}
// this is hard for my to explain and it's hard to understand
for (int i = 0; i < 35; i++){ full[i] = 0; }// clears the full[] array
int length = 1; // sets the length of leds in each column
for (int i = 0; i < 6; i++){// for every column
int maplvls[6];
int maplvlsM[6];
maplvls[i] = map(data[i+3], 0, 255, 0, 7);// map to 0-6 and 0 is all off
if (maplvls[i] > length) {
maplvlsM[i] = maplvls[i] - length;
}
for (int z = maplvlsM[i]; z < maplvls[i]; z++){
full[z + ((i * 5) - 1)] = 1; //smart math to decide where to put the 1
}
}
// this is the finshed array of 1's and 0's or on/off
int list[5][6] =
{
{ full[4], full[9], full[14], full[19], full[24], full[29]},
{ full[3], full[8], full[13], full[18], full[23], full[28]},
{ full[2], full[7], full[12], full[17], full[22], full[27]},
{ full[1], full[6], full[11], full[16], full[21], full[26]},
{ full[0], full[5], full[10], full[15], full[20], full[25]}
};
//test code to check setup...
// int list[5][6] =
//{
// { 1, 1, 1, 1, 1,1},
// { 1, 1, 1, 1, 1, 1},
// { 1, 1, 1, 0, 1, 1},
// { 1, 1, 0, 0, 0, 1},
// { 1, 0, 0, 0, 0, 0}
//};
if (j >= 6){
j=0;
}
charliePin LED0 = {c[0][j][0], c[0][j][1]};
charliePin LED1 = {c[1][j][0], c[1][j][1]};
charliePin LED2 = {c[2][j][0], c[2][j][1]};
charliePin LED3 = {c[3][j][0], c[3][j][1]};
charliePin LED4 = {c[4][j][0], c[4][j][1]};
unsigned long currentMillis = micros();
int count = 0;
if (list[0][j] == 1){ //checks to see if it's on or off
plex.charlieWrite(LED0,HIGH);
}
if (list[1][j] == 1){
plex.charlieWrite(LED1,HIGH);
}
if (list[2][j] == 1){
plex.charlieWrite(LED2,HIGH);
}
if (list[3][j] == 1){
plex.charlieWrite(LED3,HIGH);
}
if (list[4][j] == 1){
plex.charlieWrite(LED4,HIGH);
}
plex.clear();
if(currentMillis - previousMillis > interval) {
previousMillis = currentMillis;
j+=1;
}
}
Arduino + HDD + ESC Progress.
by Dave Johnson
I got everything up and running, thanks to some help from arduino.cc. I was able to spin it up to full speed, cut the slice in the hard disk plater, and even get a small POV effect with an RGB led. what’s left on the list is a hall effect sensor and some RGB led tape.
