Trevor and Villa's Test of Charlieplexing part 2
Attempted by Trevor Sibel and Alex Villasenor
Written by Alex Villasenor
`Our project involved charlieplexing many led's with only 10 pins. We used 10 wires and ran them, creating something of a very long breadboard.
Charlieplexing is a technique where a minimal amount of pins are used to light many leds by changing whether they are an input or output.
The program is supposed to run through the long list of numbers for the anode and cathode.
Then, it tells the pins that they are outputs. Then it says whether they are high or low.
Each pin is only attached to nine other pins, which is why ten pins can only light ninety leds.
Two leds, both facing opposite directions, are what is holding the pins together on the wires.
Example: Pins 4 and 5.
The sequence goes:
int An []={ 4, 5,};
int Ct []={ 5, 4,};
So, when the pins become outputs, four will be high first and five will be low. The led with the positive end on the 4 pin will light up.
Then, they are reversed. The led with the positive pin on the 5 pin will light up.
Also, technically is our second test because we also tested this on a much smaller scale.
Originally, our plan was to set this inside of a paper roller coaster model, that we received from Mr. Dickie, but this quickly became too arduous a task.
Too many wires and frail soldering would have made it difficult to stay intact.
Another original part of the plan was to fix together ninety leds, but this eventually became as many as we could fit.
We took very little care when soldering the leds to our wires.
Because of this, we had leds lighting simultaneously and in opposite order.
The wires themselves became all tangled up and difficult to manage.
If there had been more time, I hope we could have finished adding all of our lights.
Note: This is the original, uncut code for ninety leds.
This part tells which wire is an anode in the sequence
int An []={4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,4,6,5,7,6,8,7,9,8,10,9,11,10,12,11,13,4,7,5,8,6,9,7,10,8,11,9,12,10,13,4,8,5,9,6,10,7,11,8,12,9,13,4,9,5,10,6,11,7,12,8,13,4,10,5,11,6,12,7,13,4,11,5,12,6,13,4,12,5,13,4,13};
This part tells which wire is an cathode in the sequence
int Ct []={5,4,6,5,7,6,8,7,9,8,10,9,11,10,12,11,13,12,6,4,7,5,8,6,9,7,10,8,11,9,12,10,13,11,7,4,8,5,9,6,10,7,11,8,12,9,13,10,8,4,9,5,10,6,11,7,12,8,13,9,9,4,10,5,11,6,12,7,13,8,10,4,11,5,12,6,13,7,11,4,12,5,13,6,12,4,13,5,13,4};
This part tells how long the leds will be lit; the times are irrelevant
int tiempo []={1500,1500,1500,1500,1500,1500,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,800,700,600,500,300,150,100,100,100,100,100,100,200,200,200,400,600,800,
1000,500,250,200,200,200,200,200,200};
void setup()
{
for (int x=4; x<13; x++) This tells which pins are going to be used
{
pinMode(x,INPUT); And sets everything to input, so...
pinMode(x,INPUT);
}
}
...they can cycle between output and input.
void loop()
{
for(int x =0; x<90 ; x++) This tells how many times the loop should run before it restarts
{
pinMode(An[x],OUTPUT);
pinMode(Ct[x],OUTPUT);
digitalWrite(An[x],HIGH); This tells which pin will be high or low
digitalWrite(Ct[x],LOW);
delay(tiempo[x]);
pinMode(An[x],INPUT);
pinMode(Ct[x],INPUT);
}
}