void loop () { static char state = 'n'; if (digitalRead(red_button) == LOW) { state = 'r'; } if (digitalRead(blue_button) == LOW) { state = 'b'; } if (state == 'n') return; if (state == 'r') { irsend.sendSony(CAPTURE_RED, 2); } else { irsend.sendSony(CAPTURE_BLUE, 2); } delay(45); }
void loop() { for (int keyNumber=0; keyNumber<numberOfKeys; keyNumber++) { int physicalPinToRead=keyNumber+4; buttonState[keyNumber] = digitalRead(physicalPinToRead); if (buttonState[keyNumber] != lastButtonState[keyNumber]) { if (buttonState[keyNumber] == LOW) { irsend.sendSony(irKeyCodes[keyNumber], 32); Serial.println("Sending"); } lastButtonState[keyNumber] = buttonState[keyNumber]; } } }
void infrared_sendRaw(uint32_t packet) { //DEBUG_PRINTLN(packet, BIN); irsend.sendSony(packet, 20); delay(15); irrecv.enableIRIn(); }