Add calibration, servomotor, and distance travel snippets/setup
This commit is contained in:
Vendored
+16
@@ -57,5 +57,21 @@
|
|||||||
"prefix": "board.Buzzer",
|
"prefix": "board.Buzzer",
|
||||||
"body": "board.Buzzer(${1:pitch}, ${2:duration});",
|
"body": "board.Buzzer(${1:pitch}, ${2:duration});",
|
||||||
"description": "Plays a sound on the buzzer."
|
"description": "Plays a sound on the buzzer."
|
||||||
|
},
|
||||||
|
"Servomotor": {
|
||||||
|
"prefix": "board.Servomotor",
|
||||||
|
"body": "board.Servomotor(${1:PORT}, ${2:ANGLE});",
|
||||||
|
"description": "Sets the servomotor angle."
|
||||||
|
},
|
||||||
|
"DCMotorTravelDistance": {
|
||||||
|
"prefix": "MoveCm",
|
||||||
|
"body": "// Distance = ${1:30}cm, Speed = ${2:speedVar}\nboard.Move(${3:FORWARD}, ${4:POWER}, (#${1:30}*${2:speedVar}), ${5:COAST});",
|
||||||
|
"description": "Moves DC motor for a distance in cm (using #cm*Variable syntax)"
|
||||||
|
},
|
||||||
|
"SetDCMotorCalibration": {
|
||||||
|
"prefix": "SetDCMotorCalibration",
|
||||||
|
"body": "byte calib[] = { ${1:100}, ${2:100} };\nboard.SetDCMotorCalibration(calib);",
|
||||||
|
"description": "Sets DC Motor speed calibration."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ Studuino board;
|
|||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
board.InitSensorPort(PORT_A0, PIDLED);
|
board.InitSensorPort(PORT_A0, PIDLED);
|
||||||
|
byte calib[] = { 100, 100 };
|
||||||
|
board.SetDCMotorCalibration(calib);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|||||||
Reference in New Issue
Block a user