Compare commits

..
2 Commits
2 changed files with 22 additions and 0 deletions
+16
View File
@@ -57,5 +57,21 @@
"prefix": "board.Buzzer",
"body": "board.Buzzer(${1:pitch}, ${2:duration});",
"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} (ms/cm)\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, ensure speedVar is ms/cm)"
},
"SetDCMotorCalibration": {
"prefix": "SetDCMotorCalibration",
"body": "byte calib[] = { ${1:100}, ${2:100} };\nboard.SetDCMotorCalibration(calib);",
"description": "Sets DC Motor speed calibration."
}
}
+6
View File
@@ -1,10 +1,16 @@
#include <Studuino.h>
#include <Clock.h> // Keep the complete smoke-test dependency set in clangd's database.
// DC Motor Calibration (0-100)
#define M1_CALIB 100
#define M2_CALIB 100
Studuino board;
void setup() {
board.InitSensorPort(PORT_A0, PIDLED);
byte calib[] = { M1_CALIB, M2_CALIB };
board.SetDCMotorCalibration(calib);
}
void loop() {