Level 2Unit C · Session 21
21

Unit C · Telling a machine what you want

Build something of your own

What we are making: whatever you decide, out of parts you already know how to use. One session, one working thing.

The rule

Pick one input and one output from the lists below, and connect them with a decision. That is the whole brief. Everything on both lists is something you have already wired and already programmed, so nothing here is new — the only new thing is that you are choosing.

New words
InputSomething that tells your machine about the world, or about you.
OutputSomething your machine does in response.
The decisionThe if in the middle. This is the part that is yours.

Choose one from each side

7
Inputs: temperature, ultrasonic, joystick, keypad, remote, button, light sensor
6
Outputs: servo, stepper, screen, buzzer, relay, LEDs

Some that work well in one session

  1. A door that opens — ultrasonic in, servo out. Somebody gets close, the servo swings.
  2. A combination lock — keypad in, servo out. Right code, it unlocks.
  3. A reversing alarm — ultrasonic in, buzzer out. Closer means faster beeping.
  4. A remote-controlled dial — remote in, stepper out. Each button, a different position.
  5. A too-dark warning — light sensor in, screen and LED out.
  6. A thermometer with a face — temperature in, servo out. The needle is a servo arm.

How to actually do it in an hour

  1. Write the sentence first. ‘When the input does this, the output does that.’ If you cannot write it, you are not ready to wire it.
  2. Wire and test the input alone. Print its value. Do not go on until the number makes sense.
  3. Wire and test the output alone. Make it move on its own, with no sensor involved.
  4. Only then join them with one if.
  5. Pick your number. Whatever the threshold is, decide it by looking at the real readings from step 2 — not by guessing.
💡 Tip
Build it in halves, always. Nearly every failure in this session comes from wiring the whole thing and uploading the whole program at once, then having no idea which half is wrong. Test the input on its own, test the output on its own, and the join is usually three lines that just work.

Hand in

  • Your machine, working, demonstrated to one other team.
  • Your sentence, written down before you started.
  • Your threshold number, and one line on how you chose it.
  • One thing that did not work first time, and what it turned out to be.

What you learned

  • Sense, decide, act — you can now build that out of any parts in the box.
  • Testing in halves finds a fault in minutes instead of a whole session.
  • You have used eleven different components this term. Nearly every machine around you is some arrangement of the same few ideas.
Challenge optional — only if you finish early
  • Build the same machine a second way, using a different input for the same job.
20. Exactly one turn