Let's check that your infrared receiver circuit is wired properly and that your remote was programmed correctly. This program displays the numbers from the infrared remote on the micro:bit’s LED display. This example provides an easy way to determine the number associated with each key on the remote (especially the non-numbered CH and VOL keys).
- Add the tv_remote module to your micro:bit, the same way you added the cyberbot module before. For a refresher, see Add modules to your micro:bit.
- Enter, save and flash IR_Remote_Test.py.
- Put the cyber:bot board’s power switch in position 1.
- Point the remote at the IR receiver on the board, and then press and release a number on the remote. You should see the number displayed on the LED matrix.
# IR_Remote_Test.py from cyberbot import * from tv_remote import * bot(22).tone(2000, 300) while True: num = ir(10).remote() if num > -1: display.scroll( str(num), 75, wait=False ) sleep(100)
IR Interference — Are you seeing numbers appear on the micro:bit LED matrix when you are NOT pressing any numbers on the remote?
First, check to see if you are getting a syntax error report from your micro:bit.
If that’s not the problem, your IR receiver might be getting signals similar to a TV remote’s signals from some other source. The most common culprit is overhead fluorescent light fixtures. If possible, turn them off or try taking your robot to a different area.