TIMSK2 &= ~_BV(TOIE2); //Timer2 Overflow Interrupt\r
\r
pinMode(3, OUTPUT);\r
- digitalWrite(3, HIGH); // When not sending PWM, we want it low\r
+ digitalWrite(3, HIGH); // When not sending PWM, we want it low (invertiert angeschlossen)\r
\r
// COM2A = 00: disconnect OC2A\r
// COM2B = 00: disconnect OC2B; to send signal set to 10: OC2B non-inverted\r
const char YAMAHA_EFFECT6 =0x51; //Effect Toggle 70mm General / 70mm Adventure
const char YAMAHA_P5 =0xFB; //P5 PRT (1 Main Bypass)? (1587674115)
-
-void send_yamaha_ir_signal(char codebyte)
-{
- unsigned long int code = codebyte & 0xFF;
- code <<= 8;
- code |= (0xff ^ codebyte) & 0xFF;
- code |= YAMAHA_CODE_BASE;
- irsend.sendNEC(code,YAMAHA_CODE_BITS);
- Serial.println("Ok");
-}
-
//********************************************************************//
typedef struct {
//********************************************************************//
+void send_yamaha_ir_signal(char codebyte)
+{
+ unsigned long int code = codebyte & 0xFF;
+ code <<= 8;
+ code |= (0xff ^ codebyte) & 0xFF;
+ code |= YAMAHA_CODE_BASE;
+
+ //irsend changes PWM Timer Frequency among other things
+ //.. doesn't go well with PWM output using the same timer
+ //.. thus we just set output to 255 so whatever frequency is used, led is off for the duration
+ unsigned int flash_prev_selected = flash_led_selected_; //save prev. selected leds
+ flash_led_selected_ &= !(1 << BLUELED_PWM_PIN); //prevent calculate_led_level() from setting blueled
+ analogWrite(BLUELED_PWM_PIN,255); // switch led off
+
+ irsend.sendNEC(code,YAMAHA_CODE_BITS);
+
+ analogWrite(BLUELED_PWM_PIN,255); // switch off led again to be sure
+ flash_led_selected_ = flash_prev_selected; //restore led settings for calculate_led_level()
+ //is actually not necessary, since we are not multitasking/using interrupts, but just to be sure in case this might change
+
+ Serial.println("Ok");
+}
+
+//********************************************************************//
+
void setup()
{
pinMode(RF_DATA_OUT_PIN, OUTPUT);