mirror of
https://github.com/brmlab/ledbar.git
synced 2025-06-09 13:24:01 +02:00
Arduino controlled: Wait for burst, then read whole led block
This commit is contained in:
parent
2a54073785
commit
9467c94714
1 changed files with 2 additions and 1 deletions
|
@ -22,11 +22,12 @@ void setup()
|
||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
int led, i;
|
int led, i;
|
||||||
|
while (!Serial.available());
|
||||||
for (led = 0; led < cpinsets; led++) {
|
for (led = 0; led < cpinsets; led++) {
|
||||||
for (i = 0; i < CH; i++) {
|
for (i = 0; i < CH; i++) {
|
||||||
while (!Serial.available());
|
|
||||||
unsigned long s = (unsigned char) Serial.read();
|
unsigned long s = (unsigned char) Serial.read();
|
||||||
// Serial.print(cpin[led][i], DEC); Serial.print("="); Serial.print(s, DEC); Serial.print("/"); Serial.print(cmax[led][i], DEC); Serial.print(" ");
|
// Serial.print(cpin[led][i], DEC); Serial.print("="); Serial.print(s, DEC); Serial.print("/"); Serial.print(cmax[led][i], DEC); Serial.print(" ");
|
||||||
|
//lb[cpin[led][i] >> 4].setPinPWM(cpin[led][i] & 0xf, s);
|
||||||
lb[cpin[led][i] >> 4].setPinPWM(cpin[led][i] & 0xf, s * cmax[led][i] / 256);
|
lb[cpin[led][i] >> 4].setPinPWM(cpin[led][i] & 0xf, s * cmax[led][i] / 256);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue