Strawbees block coding cards for micro:bit to be used on MakeCode. Coding cards are small snippets of code that can be used to explore different robotics inventions.
Coding cards are small snippets of code that can be used to explore different concepts. They are not meant to be used as they are, but for you to tweak the numbers and combine the cards to get the expected result.
In this article, the cards are listed below by the hardware output in use, represented with a pink icon. Get creative! Try the card in MakeCode for yourself and modify the program.
Use a loop to alternate between turning the RGB LED "A" on or off. Control the rhythm of the blinking by changing the duration of the pauses.
Continuously transition the Servo "A" position from one end to the other.
Alternate between two colors of the RGB LED "A" 10 times before turning it off.
Create a variable "brightness" to store a value and then continuously set the RGB LED "A" brightness to its value. Every time the Button "A" is pressed, increment the variable by 4 units, and constrain it so that its value doesn't go over 100.
Create a variable "position" to store a value and then continuously set the Servo "A" position to its value . Every time the Button "A" is pressed, increment the variable by 4 units, and constrain it so that its value doesn't go over 100.
Use a forever loop to continuously check if the value of the built-in light sensor is below a threshold, and depending on it, turn the RGB LED "A" on or off.
Continuously set the position of the Servo "A" to the value of the light sensor, constrained from 0 to 100 (since the light level goes up to 255).
Use a loop to continuously set the hue of the RGB LED "A" to a random value and change its color.
Smoothly change the RGB LED "A" color, by iterating over different hue values from 0 to 100.
Continuously iterate over a number from 0 to 100 and use it to set the position of the Servo "A".
Create a list of colors and then continuously loop through them and set their value to the RGB LED.
Create a list of positions and then continuously loop through them and set their value as the position to the Servo "A".
Use a "toggle" variable to store the state of the RGB LED "A". 1 means on, and 0 means off.
When the Button "A" is pressed, use an if statement to check the value of the variable and then, depending on the value, turn the led on or off, and toggle the value stored inside the variable.
Use a "toggle" variable to store the state of the Servo "A" position. 1 means one position, and 0 means another.
When the Button "A" is pressed, use an if statement to check the value of the variable and then, depending on the value, set the position of the servo to 20 or 80, and toggle the value stored inside the variable.
Continuously store the value of the "x" axis of the accelerator in the variable "movement". Since the accelerator gives readings in the range -1023 to 1023, use a map to convert it to the range 0 to 100 and store it in the "hue" variable. Set the hue of the RGB LED "A" to the value of the "hue" variable.
Continuously store the value of the "x" axis of the accelerator in the variable "movement". Since the accelerator gives readings in the range -1023 to 1023, use a map to convert it to the range 0 to 100 and store it in the "position" variable. Set the Servo "A" to the value of the "position" variable.
Continuously turn off the RGB LED "A" and monitor the acceleration strength for motion detection. If it goes over 1200, turn on the RGB LED "A" for 4 seconds.
Continuously monitor the acceleration strength for motion detection. If it goes over 1200, transition the Servo "A" position back and forth.
Use a loop to continuously check if Button "A" is pressed, and then set the color of the RGB LED "A" to either red (when pressed) or blue (while not pressed).
Use a loop to continuously check if Button "A" is pressed, and then set the color position of the Servo "A" to either 0 (when pressed) or 100 (while not pressed).
Use two Robotics Boards with one acting as a sender of radio values and the other as a receiver.
Set the radio group to 1, to connect with the receiver. Continuously check if Button "A" is pressed then send a radio signal with the name "light" and the value to turn the light on or off.
Set the radio group to 1, to connect with the sender. Monitor the incoming radio signals named "light" and use its value the set one of the components of the RGB LED "A" color.
Use two Robotics Boards with one acting as a sender of radio values and the other as a receiver.
Set the radio group to 1, to connect with the receiver. Continuously send the number value of the readings from the accelerator "y" axis, converted from the range -1023 to 1023 (raw data) to 0 to 100 (valid servo positions).
Set the radio group to 1, to connect with the sender. Monitor the incoming radio number and use it to set the Servo "A" position.
Download the collection of coding cards to print or share digitally with students.
Listed below are professional learning articles to further your teaching.