You guys know you can use the
tone and
noTone functions built in to Arduino to output ~38khz to any digital pin on the digispark just with
tone(1, 38000), right? Why don't people read
the docs? This is the second thread in a week I've seen on this forum with people talking about messing up all the timer registers when the solution is as simple as a single tone command! Seriously, just skim
the core docs some time. There's a bunch of cool stuff in there!
void setup() {
tone(0, 38000);
}
void loop() {
}
results in a 37.7khz square wave on D0 pin.
void setup() {
tone(0, 40000);
}
void loop() {
}
results in about 40.1khz. IR receivers aren't too sensitive to exact frequency, so this doesn't matter too much. it will largely be a case of good enough if you enter in 37500, 38000, 40000, or whatever else your IR receiver is rated for.