Let’s get ready to code your simulated wind turbine with battery storage. To follow the coding tutorial on Makecode, click the Start Coding button below.
If you’d like to try coding your Wind Turbine without following a tutorial, you can code openly in the traditional Makecode workspace by clicking the link below.
Here’s a brief description of the coding objective:
Coding Objective:Use the LED light to indicate the charge level of the wind turbine’s battery. The faster it’s spinning, the higher the charge. The wind turbine should move in the same direction as the dial is being turned, and use the button function to stop. When the wind turbine is not moving, and therefore not generating power, the battery is considered ‘dead’ and should not display any lights.
When the dial’s touch button is pressed, the wind turbine’s servo motor is halted. The code responds to the dial’s counterclockwise (CCW) and clockwise (CW) rotations, adjusting the servo motor speed to match the dial’s position and simultaneously altering the position of the LED ring’s illuminated pixels based on the dial’s movements.
The LED ring consists of eight pixels that light up or turn off, representing the current position of the dial. The code maintains a continuous loop, updating the LED ring’s display to correspond with the dial’s position, thus visually reflecting the rotational control of the wind turbine’s blades through the dial’s interaction. How many turns of rotary dial you have to make to turn on one LED of the ring?