Programming a microcontroller
Robotics fundamentals · Free lesson 3 of 3 · Foundation level · Video 0:32 + practice
Watch the narrated lesson or read the teaching notes, try the worked example, then answer three practice questions. Video: 0:32. Allow about 5–10 additional minutes for the sample activity and quiz, or longer when needed.
Watch this lesson’s visual explainer
32-second silent teaching clip with on-screen text and English captions. Tap Play; pause to read. Full teaching notes follow the visual guide.
Open this lesson video directly
See the steps: Programming a microcontroller
Read the video transcript
Understand the idea
A program stores values, reads inputs and chooses actions. In an Arduino sketch, setup runs once and loop repeats. Use named constants for thresholds, functions for repeated work, and serial output to inspect readings.
Worked example
Pseudocode: read distance; if invalid or distance < 20 cm, stop; otherwise drive slowly. Log the distance and chosen action.
Try it yourself
Write pseudocode that stops on an invalid reading or an obstacle within 20 cm.
This visual recap supports the full lesson. It is not an instructor recording.
Understand the idea
A program stores values, reads inputs and chooses actions. In an Arduino sketch, setup runs once and loop repeats. Use named constants for thresholds, functions for repeated work, and serial output to inspect readings. A long blocking delay can prevent timely sensor checks. Prefer an elapsed-time check for tasks that must continue responding. Simulator controllers may use Python or C; syntax differs, but the sense–decide–act logic is the same. Test one output at a time before adding movement.
Worked example
Pseudocode: read distance; if invalid or distance < 20 cm, stop; otherwise drive slowly. Log the distance and chosen action.
Now check what you learned: Answer three practice questions below. Choose an answer, then press Next Question. The last question shows your score.
Check your understanding
Sample lesson 3 of 3 · 3 practice questions
Pass each sample lesson’s quiz to build your practice progress.
Answer all 3 questions, then check your score below. This is a practice check, not the full course or an official certification exam.
Learn with video
Arduino sensor and servo project demonstration · EDUvision
Source: Arduino · Supplementary video
Watch for: Look for an example related to “Programming a microcontroller”. Pause and explain how it connects to this lesson.
For a long course, choose the relevant chapter; you do not need to watch the entire video before continuing. This is a supporting program video and may cover only selected topics; it is not a separate recording of every lesson. Videos are optional; use the written lesson and exercises too.
If playback is unavailable, use the source link. Look for captions or a transcript on the provider’s page.
Optional extra practice · write your answer
Your turn
Write pseudocode that stops on an invalid reading or an obstacle within 20 cm.
Compare your answer
Read and validate the input first. If invalid OR below 20 cm, command stop; otherwise command slow forward motion. Repeat and log.
More learning options and student rewards
Your sample answer is not submitted. Passed sample quizzes are remembered only in this browser when storage is available; this does not complete the full course or approve a reward.
