SENSOR DE TEMPERATURA COM MATRIZ DE LED FICA TRAVADANDO

Caros colegas minha matriz de led faz a rolagem em torno de cinco minutos ,e depois trava a rolagem alguem pode me ajudar ou indicar aonde esteja o erro.

int data = 11; // DIN pin of MAX7219 module
int load = 12; // CS pin of MAX7219 module
int clock = 13; // CLK pin of MAX7219 module
int maxInUse = 4; //change this variable to set how many MAX7219's you'll use

MaxMatrix m(data, load, clock, maxInUse); // define module
byte buffer[10];
void setup(){


pinMode(3,INPUT); //button input
m.init(); // module initialize
m.setIntensity(15); // dot matix intensity 0-15

Serial.begin(9600); // serial communication initialize
delay(500);
Serial.println("DHTxx test!");
dht.begin();

int t = dht.readTemperature();

int h = dht.readHumidity();
delay(500);
char temp[4];
char Humid[4];
itoa(t,temp,10); // CONVERT int to char!!!!
itoa(h,Humid,10);


}

void loop(){


int t = dht.readTemperature();
int h = dht.readHumidity();

char temp[4];
char Humid[4];
itoa(t,temp,10); // CONVERT int to char!!!!
itoa(h,Humid,10);

Serial.println(temp);
Serial.println(Humid);
printStringWithShift(" SENSOR LIGADO ", 100);
printStringWithShift(" UMIDADE DO Ar: ", 100);
printStringWithShift(Humid, 100);
printStringWithShift(" % ", 100);
printStringWithShift(" Temperatura: ", 100);
printStringWithShift(temp, 100);
printStringWithShift("oC ", 100);



delay(800);
m.shiftLeft(false, true);
}


void printCharWithShift(char c, int shift_speed){
if (c < 32) return;
c -= 32;
memcpy_P(buffer, CH + 7*c, 7);
m.writeSprite(72, 0, buffer);
m.setColumn(72 + buffer[0], 0);

for (int i=0; i<buffer[0]+1; i++)
{
delay(shift_speed);
m.shiftLeft(false, false);
}
}

void printStringWithShift(char* s, int shift_speed){
while (*s != 0){
printCharWithShift(*s, shift_speed);
s++;
}
}

void printString(char* s)
{
int col = 0;
while (*s != 0)
{
if (*s < 32) continue;
char c = *s - 32;
memcpy_P(buffer, CH + 7*c, 7);
m.writeSprite(col, 0, buffer);
m.setColumn(col + buffer[0], 0);
col += buffer[0] + 1;
s++;
}
}

Exibições: 270

As respostas para este tópico estão encerradas.

Respostas a este tópico

Bom dia CF,

poderia descrever o que esta usando como hardware?

Abs.

Consegui resolver trocando o  3 INPUT  por  A0.

RSS

© 2024   Criado por Marcelo Rodrigues.   Ativado por

Badges  |  Relatar um incidente  |  Termos de serviço