Objective
Here we simulate two persons via two Crash keys and Scratch to play teeterboard.
Principle
Judge if Crash keys are pressed or not and control the lean according to Crash values.
Equipment
Build Hardware
- Setup 1:Stack CoreUSB and Sensorhub
- Setup 2:Connect two Crashes to D2 and D3 via deconcentrator.
Software Debugging
- Setup 1:Build Scratch programming environment.
- Setup 2:Start programming. Example program download:文件:Seesaw.zip
- Setup 3:Code description: Detect two Crash values for one part and lean in a fixed range according to the values.
- You need to create two variables to save the two Crash data.
- Tilt the teeterboard according two variables.
Result
Press the left Crash key, the teeterboard will tilt leftward and vice versa.
Video
|