2016-10-12 07:58:53 +02:00
|
|
|
#include "ksbit.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Blocks to control the onboard motors
|
|
|
|
*/
|
|
|
|
//% weight=30
|
|
|
|
namespace motors {
|
|
|
|
/**
|
|
|
|
* Controls the power sent to a single motor
|
|
|
|
* @param power %percent of power sent to the motor. Negative power goes backward. eg: 50
|
|
|
|
*/
|
|
|
|
//% blockId=motor_on block="motor on at %percent|%"
|
|
|
|
//% parts=dcmotor
|
|
|
|
void motorOn(int power) {
|
2016-10-27 17:44:38 +02:00
|
|
|
uBit.soundmotor.motorOn(power);
|
2016-10-12 07:58:53 +02:00
|
|
|
}
|
2016-10-27 17:44:38 +02:00
|
|
|
|
|
|
|
void motorOff() {
|
|
|
|
uBit.soundmotor.motorAOff();
|
|
|
|
uBit.soundmotor.motorBOff();
|
|
|
|
}
|
|
|
|
|
2016-10-12 07:58:53 +02:00
|
|
|
}
|