• @Ollie I'm pretty sure that's not right... @wardy's doing the right thing and you need to connect the two pins of the IR transmitter to A5/A6.

    @wardy what you were doing is fine (A6 should be 'OUTPUT', A5 should be 'GND'.). There doesn't seem to be anything on that circuit board apart from the LED - all it's doing is bringing the LED pins out to some slightly more sturdy pins. Despite the fact that the diagram says GND, it's fine to connect it to A5.

    Just a bit of background: To make the signal easier to receive, IR remote controls don't just pulse an IR LED once for each bit of data, they turn it on and off repeatedly at 38kHz (which can then be picked out from ambient light by the receiver).

    To do that easier on Espruino, we use a hardware timer (analogWrite) to pulse one pin at 38kHz, and then we output the actual signal on the other pin with digitalPulse. It works because the LED is a diode - it'll only output light when the voltage on it is one way around, and there's no harm to it when the voltage is reversed.

    If it was something more complicated than a simple LED then things would be harder though, since you probably would would to avoid reversing the voltage across it.

About

Avatar for Gordon @Gordon started