Compare commits
2
Commits
6e49b7565b
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
39f561a23f
|
||
|
|
1c241952fb
|
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} (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."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,16 @@
|
|||||||
#include <Studuino.h>
|
#include <Studuino.h>
|
||||||
#include <Clock.h> // Keep the complete smoke-test dependency set in clangd's database.
|
#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;
|
Studuino board;
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
board.InitSensorPort(PORT_A0, PIDLED);
|
board.InitSensorPort(PORT_A0, PIDLED);
|
||||||
|
byte calib[] = { M1_CALIB, M2_CALIB };
|
||||||
|
board.SetDCMotorCalibration(calib);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|||||||
Reference in New Issue
Block a user