update motor support and add demo
This commit is contained in:
36
libs/motor/motor.ts
Normal file
36
libs/motor/motor.ts
Normal file
@ -0,0 +1,36 @@
|
||||
basic.showString("A");
|
||||
motors.dualMotorPower(Motor.A, 100);
|
||||
basic.pause(2000);
|
||||
basic.showString("B");
|
||||
motors.dualMotorPower(Motor.B, 100);
|
||||
basic.pause(2000);
|
||||
basic.showString("X");
|
||||
motors.dualMotorPower(Motor.AB, 0);
|
||||
basic.pause(2000);
|
||||
basic.showString("A");
|
||||
for (var power = 0; power <= 100; power += 10) {
|
||||
basic.showNumber(power/10);
|
||||
motors.dualMotorPower(Motor.A, power);
|
||||
basic.pause(1000);
|
||||
}
|
||||
motors.dualMotorPower(Motor.AB, 0);
|
||||
basic.pause(2000);
|
||||
basic.showString("B");
|
||||
for (power = 0; power <= 100; power += 10) {
|
||||
basic.showNumber(power/10);
|
||||
motors.dualMotorPower(Motor.B, power);
|
||||
basic.pause(1000);
|
||||
}
|
||||
motors.dualMotorPower(Motor.AB, 0);
|
||||
basic.pause(2000);
|
||||
basic.showString("+");
|
||||
motors.dualMotorPower(Motor.AB, 100);
|
||||
basic.pause(2000);
|
||||
basic.showString("#");
|
||||
motors.dualMotorPower(Motor.AB, 0);
|
||||
for (power = 0; power <= 100; power += 10) {
|
||||
basic.showNumber(power/10);
|
||||
motors.dualMotorPower(Motor.AB, power);
|
||||
basic.pause(1000);
|
||||
}
|
||||
motors.dualMotorPower(Motor.AB, 0);
|
11
libs/motor/pxt.json
Normal file
11
libs/motor/pxt.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "calliope",
|
||||
"description": "Motors Example",
|
||||
"files": [
|
||||
"motor.ts"
|
||||
],
|
||||
"public": true,
|
||||
"dependencies": {
|
||||
"core": "file:../core"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user