💡 Level 1 – Fundamentals
Project 1.1: "Serial Interaction"
🚀 Project 1.1 – Serial interaction
🎯 What you’ll learn
- ✅ Goal 1: Print text from your robot to the computer.
- ✅ Goal 2: Read text typed on the computer.
- ✅ Goal 3: Use a variable in a simple decision.
Key ideas
- Serial communication: A chat between your robot and your computer.
- Variable: A box that stores a word or number.
- Decision: The robot chooses based on what you type.
🧱 Blocks glossary (used in this project)
- Serial print: Robot shows a message on your computer.
- Serial read: Robot reads what you type in the serial window.
- Variable set: Save a value with a name (like “choice”).
- if / elif / else: Make a decision.
- Loop while true: Repeat steps forever (not needed here, but handy later).
🧰 What you need
| Part | How many? | Pin connection |
|---|---|---|
| D1 R32 | 1 | USB cable (30 cm) |
- 🔌 Wiring tip: Only USB cable for this project.
- 📍 Pin map snapshot: No pins used.
✅ Before you start
- USB: Cable plugged in.
- Serial: Monitor open.
- Test print: Run this first.

import machine # Load base library to start
print("Clu-Bots Ready!") # Show start message on the serial screen
🎮 Microprojects (5 mini missions)
🎮 Microproject 1.1.1 – Hello Clu-Bots
- Blocks used:
- Serial print
- Block sequence:

import machine # Load base library
print("Hello Clu-Bots") # Print a friendly message to the serial screen
- Reflection: Your robot can speak to you through the serial screen.
- Challenge: Change “Hello Clu-Bots” to your name or a fun phrase.
🎮 Microproject 1.1.2 – Ready message
- Blocks used:
- Serial print
- Block sequence:

import machine # Load base library
print("Ready!") # Print a start signal so you know the code is running
- Reflection: A start signal helps you verify communication.
- Challenge: Add a second line: “Let’s go!”
🎮 Microproject 1.1.3 – Echo command
- Blocks used:
- Serial print
- Serial read
- Variable set
- Block sequence:

import machine # Load base library
print("Type a command:") # Ask the user for a word or phrase
command = input() # Read the user’s input into variable 'command'
print("You typed:", command) # Show the exact input back to the user
- Reflection: Your robot can listen and repeat what you type.
- Challenge: Try numbers, words, and short phrases; see the echo.
🎮 Microproject 1.1.4 – Simple decision
- Blocks used:
- Serial read
- Variable set
- if / else
- Serial print
- Block sequence:
-

import machine # Load base library
print("Type 1 or other:") # Ask the user to choose
choice = input() # Read the choice and store in 'choice'
if choice == "1": # If the user typed the number 1
print("Hello") # Respond with Hello
else: # For any other input
print("Bye") # Respond with Bye
- Reflection: Decisions change the robot’s behavior.
- Challenge: Add “2” as a second choice with a special message.
🎮 Microproject 1.1.5 – Tiny menu
- Blocks used:
- Serial print
- Serial read
- Variable set
- if / elif / else
- Block sequence:
import machine # Load base library
print("Menu: 1=Hello, 2=Bye") # Show the simple menu
choice = input() # Read the user’s selection
if choice == "1": # Option 1 selected
print("Hello") # Print Hello
elif choice == "2": # Option 2 selected
print("Bye") # Print Bye
else: # Any other input
print("Invalid choice") # Inform about invalid option
- Reflection: Menus guide the robot’s actions step by step.
- Challenge: Add “3=Surprise!” with your own custom message.
✨ Main project – Interactive serial menu
🔧 Blocks steps (with glossary)
Blocks used:
- Serial print: Show menu options
- Serial read: Get the user’s choice
- Variable set: Save the choice
- if / elif / else: Decide the response
Block sequence:
import machine # Load base library
print("Menu: 1=Hello, 2=Bye, 3=Surprise") # Show the full menu
choice = input() # Read the user’s selection
if choice == "1": # If 1 is chosen
print("Hello") # Respond with Hello
elif choice == "2": # If 2 is chosen
print("Bye") # Respond with Bye
elif choice == "3": # If 3 is chosen
print("Surprise!") # Respond with Surprise
else: # If input is anything else
print("Invalid choice") # Inform that the choice is not valid
📖 External explanation
- What it teaches: How robots can read your input and react with different messages.
- Why it works: The program compares your input to conditions (if/elif/else) and prints the matching response.
- Key concept: Decisions in code control what the robot does next.
✨ Story time
- Mission hook: Imagine your robot is taking orders like a friendly waiter. You choose from the menu, and it serves the right message every time.
🕵️ Debugging (2 common problems)
🐞 Debugging 1.1.A – Nothing on screen
- Problem: No text appears.
- Clues: Serial monitor is closed or not focused.
- Broken code:
print("Hello Clu-Bots") # This prints, but you won’t see it without serial open
- Fixed code:
print("Hello Clu-Bots") # Open the serial monitor before running
- Why it works: The serial window must be open to show messages.
- Avoid next time: Always open serial first and look for “Ready!”.
🐞 Debugging 1.1.B – Choice not recognized
- Problem: You typed 2 but didn’t see “Bye”.
- Clues: Extra spaces or different characters.
- Broken code:
choice = input() # If you typed a space or symbol, it won’t match "2"
if choice == "2":
print("Bye")
- Fixed code:
choice = input() # Type exactly 1, 2, or 3 (no spaces)
if choice == "2": # Exact match triggers the correct response
print("Bye")
- Why it works: Exact string matching is required.
- Avoid next time: Type exactly the option number.
✅ Final checklist
- Screen: I saw “Ready!” at the start.
- Action: I printed and read messages.
- Change: My menu choice changed the result.
📚 Extras
- 🧠 Student tip: Add “4=Joke” and print a funny line.
- 🧑🏫 Instructor tip: Watch for closed serial windows and exact input matching.
- 📖 Glossary: Serial, Variable, if/else, Menu.
- 💡 Mini tips: Keep messages short; always test with “Ready!” first.

