Less awkward ir signal generation

This commit is contained in:
Thammi 2013-08-26 20:40:02 +02:00
parent cbecd7ef38
commit 09c76867a4

View File

@ -11,7 +11,6 @@
#define not_follow(from_port, from_pin, to_port, to_pin) { if(from_port & (1 << from_pin)) to_port |= 1 << to_pin; else to_port &= ~(1 << to_pin); } #define not_follow(from_port, from_pin, to_port, to_pin) { if(from_port & (1 << from_pin)) to_port |= 1 << to_pin; else to_port &= ~(1 << to_pin); }
ISR(TIMER0_COMPA_vect) { ISR(TIMER0_COMPA_vect) {
TCNT0 = 0;
PORTD ^= 1 << 2; PORTD ^= 1 << 2;
} }
@ -41,8 +40,7 @@ int main(void) {
// initialize timer // initialize timer
TIMSK0 |= (1 << OCIE0A); TIMSK0 |= (1 << OCIE0A);
// this should be a 105 or something ... measure multiple bugs with a real measurement device OCR0A = 105;
OCR0A = 85;
// no prescaler // no prescaler
@ -86,6 +84,7 @@ int main(void) {
// send IR // send IR
if(!(PIND & (1 << 6))) { if(!(PIND & (1 << 6))) {
TCCR0A = (1 << WGM01);
TCCR0B = (1 << CS00); TCCR0B = (1 << CS00);
} else { } else {
TCCR0B = 0; TCCR0B = 0;