Overview
Make a seesaw which can detect the ground and avoid touching it.
Suitable kit: mCookie302
Module List
Module
Other Equipment
- USB cable*1
- Sensor cable*3
- Sensor shell
- Building blocks or other fixation structures
Modules Setup
Setup
- Assemble modules and sensors together:
- Stick red core module, battery base and green extension module together;
- Connect the Servo Connector to pin 6/7 of Hub;
- Connect the Servo to pin 1 (the lower three pins) of Servo Connector;
- Connect Line Finder to pin A0/A1 and A2/A3 of Hub;
- Plug one end of USB cable into the battery base, and connect the other to the computer;
Programming
Required Program Blocks
Programming Thought
If the left end of the seesaw is not close enough to the ground, the seesaw will keep spinning to left most. Similarly, if the right end of the seesaw is not close enough to the ground, the seesaw will keep spinning to right most.
Start to Program
1. The seesaw spins to left
Variable servo is for saving the angle of servo.
If the Line Finder of pin A0 is larger than 100 (the left end of the seesaw is not close enough to the ground), execute that repeatedly. Variable servo increases 1. The servo spins to angle servo (the left end of the seesaw lowers).
2. The seesaw spins to right
If the Line Finder of pin A2 is larger than 100 (the right end of the seesaw is not close enough to the ground), execute that repeatedly.
Variable servo reduces 1. Servo spins to angle servo (the right end of the seesaw lowers).
Test the result
You can see the seesaw spins automatically.
Q: Once starting, it can’t stop. How to make it stop 3s after running 5 times and then run again.
A: Execute running code 5 times with every time program block, and add a 3s delay to that.
Execute the internal program (seesaw actions) 5 times repeatedly. The internal program is: seesaw actions.
Delay 3s (seesaw stops for 3s after running 5 times for the substitution of players).
Technical Specification
Relative Cases
FAQ
|