Level 2Project 1 · Session 14
14

Project 1 · Your first real device · Build

Build it

What we are making: the whole device, working. Built in halves, as always.

The order, and it matters

  1. The sensor alone. Print its value. Do not go on until the number makes sense.
  2. The output alone. A tiny program that just makes it move, sound or switch — no sensor involved.
  3. The screen alone, showing fixed text.
  4. Now join them, one at a time: sensor to screen first, then the decision, then the output.
  5. Ten trials. Make it happen ten times in a row and count how many times the device does the right thing.
💡 Tip
Three things wired at once, all untested, is the way to lose this session. Each one takes about five minutes to test on its own. Do that and the joining is usually three lines that work first time.

If it works eight times out of ten

That is not working. Something is marginal, and it is almost always one of two things: the threshold is too close to the normal reading, or a wire is only just making contact. Find out which, today. A device that works most of the time will fail in front of visitors, because that is invariably when it fails.

What you seeWhyWhat to do
The output never firesThe decision, not the parts.Print the reading and the decision. You will see which is wrong in a minute.
It fires constantlyThe comparison is the wrong way round.Swap > for <, or move the threshold.
It worked, now it does notA wire came loose.Check what you touched most recently, not the code you last changed.
It flickers on the boundaryChatter, as in session 12.Trigger above one number, release below a lower one.

Before you leave

  • Your device working ten times out of ten.
  • Your code saved where you can find it.
  • Everything packed against the bin card.
Challenge optional — only if you finish early
  • Get your input working with a second, different sensor as a backup.
13. The brief, and your plan