Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
research-plan-programming [2024/06/26 18:02] – daniel.chen | research-plan-programming [2024/06/26 19:38] (current) – daniel.chen | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== programming ====== |
+ | |||
+ | [[daniel-chen| Daniel Chen]] | ||
+ | |||
+ | ==== These are the codes for testing if my robot is working correctly ==== | ||
[[daniel-code-car-part| car part]] | [[daniel-code-car-part| car part]] | ||
[[daniel-code-pen-part| pen part]] | [[daniel-code-pen-part| pen part]] | ||
- | ====== car part ====== | ||
- | input.onButtonPressed(Button.A, | ||
- | wuKong.setMotorSpeed(wuKong.MotorList.M1, | ||
- | wuKong.setMotorSpeed(wuKong.MotorList.M2, | ||
- | T = 1 | ||
- | }) | ||
- | input.onButtonPressed(Button.AB, | ||
- | if (T == 1) { | ||
- | wuKong.setMotorSpeed(wuKong.MotorList.M1, | ||
- | wuKong.setMotorSpeed(wuKong.MotorList.M2, | ||
- | T = 0 | ||
- | } else { | ||
- | wuKong.stopMotor(wuKong.MotorList.M1) | ||
- | wuKong.stopMotor(wuKong.MotorList.M2) | ||
- | T = 1 | ||
- | } | ||
- | }) | ||
- | input.onButtonPressed(Button.B, | ||
- | wuKong.setMotorSpeed(wuKong.MotorList.M1, | ||
- | wuKong.setMotorSpeed(wuKong.MotorList.M2, | ||
- | T = 1 | ||
- | }) | ||
- | let T = 0 | ||
- | T = 1 | ||
- | ====== pen part ====== | ||
- | basic.forever(function () { | + | [[daniel-code-wheel-part| wheel part]] |
- | if (input.buttonIsPressed(Button.A)) { | + | |
- | wuKong.setServoSpeed(wuKong.ServoList.S0, | + | |
- | } else { | + | |
- | wuKong.setServoSpeed(wuKong.ServoList.S0, | + | |
- | } | + | |
- | }) | + | |
- | ====== | + | |
- | https:// | + | |
- | *This is a code written by someone else. This is not the final version, but it shows that omniscience can be use in micro bit. |