Created
August 5, 2012 11:24
-
-
Save anonymous/3263996 to your computer and use it in GitHub Desktop.
working
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "TimerOne.h" | |
#include "Arduino.h" | |
extern "C" { | |
#include "irmpconfig.h" | |
#include "irmp.h" | |
#include "irsndconfig.h" | |
#include "irsnd.h" | |
} | |
#define SER_BAUD 115200 | |
#define US (1000000 / F_INTERRUPTS) | |
IRMP_DATA irmpd; | |
void setup() | |
{ | |
Serial.begin(SER_BAUD); | |
pinMode(IRSND_BIT, OUTPUT); | |
digitalWrite(IRSND_BIT, HIGH); | |
delay(20); /* make sure the greeting string is out before starting */ | |
irsnd_init(); // initialize irsnd | |
Timer1.initialize(US); | |
Timer1.attachInterrupt(timerinterrupt); | |
} | |
void loop() | |
{ | |
// Cannot get 15:0:11:0 = Grundig code to work, but NEC DOES work | |
IRMP_DATA irmp_data; | |
irmp_data.protocol = IRMP_NEC_PROTOCOL; // sende im NEC-Protokoll | |
irmp_data.address = 0x00FF; // verwende Adresse 0x00FF | |
irmp_data.command = 0x0001; // sende Kommando 0001 | |
irmp_data.flags = 0; // keine Wiederholung! | |
int result; | |
result = irsnd_send_data(&irmp_data, TRUE); | |
if (result != 1) Serial.println("ERROR"); | |
if (result == 1) Serial.println("Sent"); | |
delay(1500); | |
} | |
void timerinterrupt() | |
{ | |
uint8_t irsnd_is_on; | |
irsnd_ISR(&irsnd_is_on); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment