You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • For the receiver, for the remote control I used, the time the signal was 0 doesn't matter so it isn't measured (it's the opposite of the time the signal is 1). If you were using a different brand of remote control socket then it could be different...

    For:

    var bits = (CODE & ~0b11111) | command;
    

    You're correct - it makes the last 5 bits of the code zero, and then it adds in the command. This is because the last 5 bits contain the command code. They could have just been zeroed when CODE was set, but I wanted to make it so you could just copy and paste the code you got in order to make it work.

    socketOn = !socketOn; is just so that when you press the button on Espruino, it toggles the socket between turning on and turning off. If you had two buttons you could assign one to sendMultiple(0b11110); and one to sendMultiple(0b01110);...

About

Avatar for Gordon @Gordon started