Teach Remote lab lessons

Teach lesson

Visual programming with a real Arduino (4/4): mini-controller

Students combine visual-programming inputs, decisions, and outputs to build a mini-controller and document real-board test evidence.

  • Arduino Board (visual)
  • 60 min
  • Secondary (ages 14–15)
  • English
  • Embedded systems
Arduino Board (visual)
Arduino Board (visual)

Learning Outcomes

  • Design a mini-controller with input, decision and output.

  • Test the program with two defined cases.

  • Explain the behavior and one reasonable improvement.

Student activity preview

Activity Content

Preview only. In a class session, students can fill in responses and submit their work to the teacher.

1

Choose the challenge

10 min

A mini-controller is a program that reads an input, decides, and produces an output, repeating in the loop. Choose one of these two base challenges (they use
the built-in LED, no wiring):

In this project, Arduino run first is for preparation that only happens once.
The main part (read input, decide, and act) goes inside Arduino loop forever
because the controller must keep checking the input.

- Threshold indicator: read a potentiometer; if it passes a threshold, the LED
stays steady on; otherwise, the LED blinks slowly.
- Two-mode alert: read a button; if pressed, the LED blinks fast; otherwise,
it blinks slowly.

*Optional extensions (only if your teacher confirms the hardware): use external
LEDs for a traffic light, or a servo motor for two positions. These are not
required.*

Which challenge do you choose? State the input and the output you will use.

Fill the table before you build. Use only one row for your base design and
leave the extra rows empty. In that row, write which input you will read, what
decision or threshold the program will use, which output you will observe, and
how you will know it works.

Goal Input Decision or threshold Output How you will know it works
2

Build a first version

22 min

Build a small first version. Do not try to make it perfect at first. It must
include: one input reading, one if / else decision, one observable output, and a
wait if the behavior repeats too quickly.

  1. Open arduino-visual-board.

  2. Create the program with blocks inside Arduino loop forever.

  3. Verify / compile. Fix any errors that appear.

  4. Upload into device.

  5. Test two cases: one that triggers one branch of the decision and one that triggers the other.

Example of the "Threshold indicator" challenge (steady on above the threshold,
slow blink below):

Visual block diagram: inside Arduino loop forever there is an if condition reading analog pin A0 greater than or equal to threshold; in do, built-in LED HIGH; in else, built-in LED HIGH, wait 400 milliseconds, built-in LED LOW, and wait 400 milliseconds.

Reference diagram for the Threshold indicator challenge. Above the threshold the LED stays steady; below it, the LED blinks slowly.

Arduino loop forever:
   if  [read analog pin# [A0]]  [≥]  [threshold]
   do:
      [set built-in LED] [HIGH]        # above the threshold: steady on
   else:
      # below the threshold: slow blink
      [set built-in LED] [HIGH]
      [wait] 400 milliseconds
      [set built-in LED] [LOW]
      [wait] 400 milliseconds

Describe the result of the first version. Include at least two tests with their inputs and what the LED did.

3

Improve one thing

15 min

Choose one small improvement and apply it:

- Adjust the threshold so it switches where you want.
- Change a wait time so the blink is easier to see.
- Use a repeat N times block to avoid copying blocks.
- Make the two modes easier to tell apart.

What improvement did you make? Why was it needed? What evidence shows that it improved?

4

Present the controller

13 min

Mini-controller summary

Submit a short explanation (text or screenshot) with:

1. Mini-controller name.
2. Input used.
3. Main decision (and threshold, if any).
4. Observable output.
5. Two tests and their results.
6. One improvement applied or proposed.

What did you learn about programming a real system that is different from programming only on a screen? Think about the difference between "it should work" and "I observed it".