0
comment
comment
on 10/2/2011 12:04 PM
Inspired by the minimalists I tried this out on the arduino:
int speakerPin = 11;
void outp(byte value) {
    analogWrite(speakerPin, value); delayMicroseconds(200);
}
void setup() {
    pinMode(speakerPin, OUTPUT);
    // Set up Timer 2 to do pulse width modulation on the speaker
    // pin.
    // Use internal clock (datasheet p.160)
    ASSR &= ~(_BV(EXCLK) | _BV(AS2));
    // Set fast PWM mode  (p.157)
    TCCR2A |= _BV(WGM21) | _BV(WGM20);
    TCCR2B &= ~_BV(WGM22);
    // Do non-inverting PWM on pin [...]






