led anination proportional to speed

bluepill
JbLb 6 years ago
parent 97d2cd0dec
commit 25f29d6210

@ -294,16 +294,31 @@ void loop()
if (iTimeSend > timeNow)
return;
iTimeSend = timeNow + TIME_SEND;
if (cmd2 == 0)
return;
iTimeSend = timeNow + ((200 - abs(cmd2)) * 2); // TIME_SEND
strip.clear();
strip.setPixelColor(idx_led, strip.Color(128, 0, 0));
if (idx_led < strip.numPixels() -1 )
{
idx_led++;
if (cmd2 > 0){
if (idx_led < strip.numPixels() -1 )
{
idx_led++;
}
else
{
idx_led = 0;
}
}
else
{
idx_led = 0;
if (idx_led > 0 )
{
idx_led--;
}
else
{
idx_led = strip.numPixels() -1 ;
}
}
strip.show();
strip.show();
}

Loading…
Cancel
Save