DFRobot DFR0274 Краткое руководство по эксплуатации - Страница 7
Просмотреть онлайн или скачать pdf Краткое руководство по эксплуатации для Микроконтроллеры DFRobot DFR0274. DFRobot DFR0274 12 страниц. Rgb led strip driver shield
pinMode(IR_PIN, INPUT);
digitalWrite(LED_PIN, LOW);
pinMode(RedPin, OUTPUT);
pinMode(GreenPin, OUTPUT);
pinMode(BluePin, OUTPUT);
Serial.begin(9600);
}
void loop()
{
digitalWrite(LED_PIN, HIGH);
int key = get_ir_key();
digitalWrite(LED_PIN, LOW);
do_response(key);
if (Flash_flag)
{
for (int i=0;i<255;i++)
{
setColor(i, 0, 255-i);
delay (10);
}
for (int i=0;i<255;i++)
{
setColor(255-i, i, 0);
delay (10);
}
for (int i=0;i<255;i++)
{
setColor(0, 255-i, i);
delay (10);
}
}
else
{
if (Blue_flag)analogWrite(BluePin, Blue_Bright);else analogWrite(BluePin,
0);
if (Red_flag)analogWrite(RedPin, Red_Bright);else analogWrite(RedPin, 0);
if (Green_flag)analogWrite(GreenPin, Green_Bright);else
analogWrite(GreenPin, 0);
}
delay(130);
keypresses
}
/*
wait for a keypress from the IR remote, and return the
integer mapping of that key (e.g. power button on remote returns
the integer 1429)
*/
int get_ir_key()
{
int pulse[IR_BIT_LENGTH];
int bits[IR_BIT_LENGTH];
do {} //Wait for a start bit
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
// turn LED off while processing response
// 2 cycle delay to cancel duplicate