Vaja como fazer para o Arduino identificar a quantidade de expansores (74hc595, max7219, etc) conectados em série. veja o vídeo.
vídeo anterior sobre o 74HC595:
http://youtu.be/SwQECcYdEkI
Link para o artigo:
http://www.arduinoecia.com.br/2014/04/Painel-de-led-max7219.html
código:
int conta_modulos(int pino, float Rb, float Rp){
float La = analogRead(pino);
double N = ( 1 / ( ((1023*Rb)/La) - Rb ) ) / ( 1 / Rp );
int n = round(N);
Serial.print(N);
Serial.print(" arredondado: ");
Serial.println(n);
return n;
}
void setup() { Serial.begin(9600); }
void loop() {
int q1 = conta_modulos(A0, 1000, 10000); //resistor gnd->1K, resistor paralelo 10k
delay(1000);
}
Nenhum comentário:
Postar um comentário