Unit C · Telling a machine what you want
What we are making: a machine you control with the remote from your kit, from the other side of the classroom.
Part 2 of 5
The remote has an infrared LED in the end. It flashes light you cannot see, in a pattern, and every button has its own pattern. The receiver on your board sees the flashes and hands your program a number.
Here is the part worth understanding: nobody can tell you what your numbers will be. They depend on the remote. So today's job is to find them out and write them down — which is exactly what an engineer does with undocumented hardware.
Part 3 of 5
Part 4 of 5
if lines in the program.| What you see | Why | What to do |
|---|---|---|
| Serial Monitor prints nothing | The pin order is wrong. | Read the labels on the module itself. OUT is not always the first pin. |
| The same huge number every time | That is the repeat code. | It is sent while a button is held down. Tap the button instead. |
| Works close up, not across the room | Something is shading the receiver. | Move it clear. Strong sunlight also drowns the signal. |
| A different number on every press | An older library version. | You need IRremote version 4 or later. Tell your teacher. |
Part 5 of 5
In this session