About the code
The variables
topAngle
and
bottomAngle
indicate where the arm should start and stop. The bottom angle must
be such that the arm is able to dip the "soap ring" completely into the water. The top angle must be "low"
enough for the hand to lift the ring in front of the air from the propeller.
fanTime
is how many seconds the arm
is in front of the propeller before the soap runs out.
fanPower
is the speed of the motor and can be up to 1023.
If the power is too low, the bubbles will not be inflated. Too much force, and the bubbles burst. The running
variable determines whether the machine should work or go into pause mode, and can be changed with
buttons A and B.
To control the servo, we use the block
servo write
and select P2 as the servo is connected to P2 (see mounting
plate). To control the motor, we use
analog write
and select P0. To control the LED, we use
digital write
and
select P1.
Analog write
can also be used here, as long as the number is between 0 (darkest) and 1023
(brightest)
Things to try:
Can you get the machine to start with a loud sound (micro:bit V2) or perhaps with extra bright light from a
flashlight?
70
º
110
º
Different angles gives different rotation. Please
note that decreasing the angle makes the servo
rotate clockwise. Thats why the top angle is
lower than the bottom angle.