Hi everyone, so I have a problem, and can´t find whats wrong for quite some time
I had this project done about 3 years ago and everything worked, it has 2 8x8 led matrix, 1 micro servo motor and a buzzer. Initially the led matrix were attached to a protoboard, and all my problems began when I needed to simply make the leds work outside the protoboard.
So I have bought the parts needed from a online schematic and put all together and now it is even worse than before. Here is the schematics of how it is now:
The only thing I change was the port for the buzzer and servo to work with the code (but tried to change the code to be ok with schematics and also didn´t work)
I had tested with a voltmeter the componets and they all work.
Here is the code:
#include <LedControl.h>
#include <Servo.h>
Servo servo1;
int DIN = 12;
int CS = 11;
int CLK = 10;
const int buzzer = 9;
unsigned long delaytime=10;
int d = 50;
int row;
int col;
int i;
int j;
int l = 0;
LedControl lc=LedControl(DIN,CLK,CS,1);
void setup(){
lc.shutdown(0,false); //The MAX72XX is in power-saving mode on startup
lc.setIntensity(0,15); // Set the brightness to maximum value
lc.clearDisplay(0); // and clear the display
servo1.attach(8);
pinMode(buzzer, OUTPUT);
}
void loop() {
// if((servo1.read() != 0) || (servo1.read() != 180) ){
//servo1.write(0);
//if((servo1.read() != 0) || (servo1.read() != 1) || (servo1.read() != 2) ||
//(servo1.read() != 178) ||
//(servo1.read() != 179) || (servo1.read() != 180) ){
//servo1.write(0);
// }
l = 0;
d = 50;
while(l<10){
for(i=8;i>-1;i--){
func(i,d);
}
l = l +1;
d = d - 5;
}
pinta(0);
if((servo1.read()) == 0 ){
servo1.write(180);
delay (1);
} else{
servo1.write(0);
delay (1);
}
}
void func(int i, int d){
for(int j=0;j<i;j++){
pinta(j);
pinta(j+1);
apaga(j,d);
tone(buzzer, 882);
delay(d);
noTone(buzzer);
delay(d);
}
}
void pinta(int r){
for(int row=r;row<r+1;row++) {
for(int col=0;col<8;col++) {
//delay(delaytime);
lc.setLed(0,row,col,true);
lc.setLed(1,row,col,false);
// delay(delaytime);
}
}
}
void apaga(int r, int d){
for(int row=r;row<r+1;row++) {
for(int col=0;col<8;col++) {
delay(d);
lc.setLed(0,row,col,false);
lc.setLed(1,row,col,false);
delay(d);
}
}
}
(translation for two word from the code:
pinta=color
apaga=erase)
Yesterday the led matrixes were working a little bit but stopped after 1 minute, now only the buzzer is working and with a lower tone than before, bought a new matrix but also same problem
Please help in any way you can, I tried everythig in this last month, you guys are my last resort, thanks !
Quick edite here: The arduino uno will work with both usb connection and the other one, but when I turn it from the other one only the buzzer is workin, and when I attach to power via usb not even the buzzer works, only the arduino, and nothing else