๐ŸŽฎ Control – Your “Conductor”

What it is: Blocks that dictate when and how instructions are executed.

What it does: It decides the pace and order of your program.

Example: Repeat an action indefinitely (loop), wait a certain amount of time, or execute something only once.

๐Ÿ‘‰ It’s the conductor who organizes everything.


๐Ÿงฉ Fun Guide to Control Blocks (Clu-blocks Pro)

โš ๏ธ Important! Control blocks decide when, how often, and under what conditions your robot does things. Theyโ€™re like the director of a movie โ€” without them, your robot just sits there waiting for instructions!

#BlockWhat it doesDropdown optionsWhat the options mean
1When while_test trueStarts a loop that runs while a condition is trueโ€”Keeps repeating as long as the condition stays true
2repeat 10Repeats the blocks inside 10 timesโ€”You choose how many times to repeat โ€” great for animations or patterns
3Delay 1 SecondPauses the program for a momentsecond, ms, ussecond: 1 second
ms: milliseconds (1000 ms = 1 sec)
us: microseconds (super tiny pauses)
4for each i from 0 to 4 rangeLoops through numbers from 0 to 4โ€”Useful for counting, repeating actions with a changing value
5Try / ExceptTries to run a block โ€” if it fails, does something elseโ€”Helps avoid crashes โ€” great for testing risky actions
6Break out of loopStops the loop immediatelybreak out, continue with next iterationbreak out: exit the loop now
continue: skip this round and go to the next
7Start threadStarts a separate task that runs in the backgroundโ€”Lets your robot do two things at once โ€” like blinking and listening at the same time
8def testThreadDefines what the thread will doโ€”You write the actions that the background task should follow
9Timer setup timSets up a timer that runs after a delayMode: One Shot, RepeatOne Shot: runs once
Repeat: runs again and again
10tim_callback with timWhat happens when the timer finishesโ€”You decide what the robot should do when the timer goes off
11System running time msGets how long the robot has been runningโ€”Useful for tracking time or creating time-based actions
12Set setup timeout 2000 msSets a timeout limit for actionsโ€”After this time, the robot will stop waiting and move on
13WDT feedingKeeps the system alive and prevents freezingโ€”Like giving your robot a snack so it doesnโ€™t fall asleep!

๐Ÿง  Quick Tips for Students

  • Loops = repeat magic: Use them to make things happen again and again.
  • Delays = timing control: Perfect for blinking lights or waiting for input.
  • Try/Except = safety net: Helps your robot recover from errors.
  • Threads = multitasking: Your robot can do more than one thing at a time!
  • Timers = scheduled actions: Great for reminders, alarms, or timed reactions.
On this page