Hello everyone, I'm working on a project using the AtTiny85 and the arduino as an ISP, I'm kind of stuck and could use some help.
The Project: I have a 4 x 5 charlieplexed LED matrix being controlled by 5 pins, I have the code and tested it with pins (13,12,11,10,9) on my Uno and it works perfectly, the LED's light up scrolling through the message "PARTY TIME" (Soon to be changed to something a little more useful).
The Problem: Despite this code working perfectly for my Arduino Uno, when I change the pins being used to 0,1,2,3,4 for use with the AtTiny85 and upload it, connect the AtTiny85 to the LEDs and add power, it doesn't work properly, nothing happens, I doesn't work as it should. Initially no LEDs turned on and I thought my chip was broken so I uploaded the blink example to test it and the chip is working perfectly fine but just in-case I re-burned the boot-loader for it, tested it out with the blink script, then uploaded my code again. Now one LED turns on and stays on which makes even less sense to me than no LEDs turning on. So right now I'm stumped because its supposed to be scrolling through a message. Again I would like to stress the fact that the code worked perfectly with my arduino uno and the only changes I made before uploading it to the AtTiny85 was changing the pin designations to 0,1,2,3,4 instead of 13,12,11,10,9 so I could use it with the AtTiny85.
Any help would be GREATLY appreciated, Thanks!
I have also added my code below in-case anyone sees something that would make this not work with the AtTiny85
The Code:
int pins[] = {0,1,2,3,4};
int array[4][5] = { // The "Frame" of the clip that its on
{1,1,1,1,1},
{1,1,1,1,1},
{1,1,1,1,1},
{1,1,1,1,1}
};
int animation[4][53] = { // The clip that it scrolls through saying "PARTY TIME"
{0,0,0,0,0,1,1,1,0,0,1,0,0,1,1,1,0,0,1,1,1,0,1,0,0,0,1,0,0,1,1,1,0,1,1,1,0,1,0,0,0,1,0,1,1,1,0,1,0,0,0,0,0},
{0,0,0,0,0,1,0,1,0,1,0,1,0,1,0,1,0,0,0,1,0,0,0,1,0,1,0,0,0,0,1,0,0,0,1,0,0,1,1,0,1,1,0,1,1,0,0,1,0,0,0,0,0},
{0,0,0,0,0,1,1,1,0,1,1,1,0,1,1,1,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,1,0,0,0,1,0,1,0,1,0,0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,1,1,1,0,1,0,0,0,1,0,1,1,1,0,1,0,0,0,0,0}
};
int DelayRate = 1;
int frameRepeat = 1;
void setup() {
reset();
}
void loop(){
for(int frame = 4; frame < 52; frame ++){ // frame has to intialy equal 4
for(int i = 0; i < 5; i++){
for(int j = 0; j < 4; j++){
array[j][i] = animation[j][i+frame-4];
}
}
for(int i = 0; i < frameRepeat; i++){
AnimateArray();
}
}
}
void AnimateArray() {
for(int anim = 0; anim < 5; anim ++){
for(int rows = 0; rows < 4; rows++){
if(array[rows][anim] == 1){
if(3-rows >= anim){
pinMode(pins[3-rows+1],OUTPUT);
digitalWrite(pins[rows+1],LOW);
}
else {
pinMode(pins[3-rows],OUTPUT);
digitalWrite(pins[rows],LOW);
}
pinMode(pins[anim],OUTPUT);
digitalWrite(pins[anim],HIGH);
delay(DelayRate);
reset();
}
}
}
}
void reset() {
for(int i = 0; i <= 5; i++){
pinMode(pins[i],INPUT);
}
}