basic servo simulation (#297)
This commit is contained in:
@ -201,6 +201,7 @@ namespace pins {
|
||||
*/
|
||||
//% help=pins/servo-write-pin weight=20
|
||||
//% blockId=device_set_servo_pin block="servo write|pin %name|to %value" blockGap=8
|
||||
//% parts=microservo trackArgs=0
|
||||
void servoWritePin(AnalogPin name, int value) {
|
||||
PINOP(setServoValue(value));
|
||||
}
|
||||
|
@ -29,6 +29,37 @@
|
||||
{"pinIndices": [2, 3]}
|
||||
]
|
||||
},
|
||||
"microservo": {
|
||||
"simulationBehavior": "microservo",
|
||||
"visual": {
|
||||
"builtIn": "microservo",
|
||||
"width": 74.85,
|
||||
"height": 200,
|
||||
"pinDistance": 10,
|
||||
"pinLocations": [
|
||||
{"x": 30, "y": 5},
|
||||
{"x": 37, "y": 5},
|
||||
{"x": 45, "y": 5}
|
||||
]
|
||||
},
|
||||
"numberOfPins": 3,
|
||||
"pinDefinitions": [
|
||||
{"target": {"pinInstantiationIdx": 0}, "style": "croc", "orientation": "+Z"},
|
||||
{"target": "threeVolt", "style": "croc", "orientation": "+Z"},
|
||||
{"target": "ground", "style": "croc", "orientation": "+Z"}
|
||||
],
|
||||
"instantiation": {
|
||||
"kind": "function",
|
||||
"fullyQualifiedName": "pins.servoWritePin",
|
||||
"argumentRoles": [
|
||||
{"pinInstantiationIdx": 0, "partParameter": "name"}
|
||||
]
|
||||
},
|
||||
"assembly": [
|
||||
{"part": true, "pinIndices": [2]},
|
||||
{"pinIndices": [0, 1]}
|
||||
]
|
||||
},
|
||||
"neopixel": {
|
||||
"simulationBehavior": "neopixel",
|
||||
"visual": {
|
||||
|
3
libs/core/shims.d.ts
vendored
3
libs/core/shims.d.ts
vendored
@ -585,7 +585,8 @@ declare namespace pins {
|
||||
* @param value angle or rotation speed, eg:180,90,0
|
||||
*/
|
||||
//% help=pins/servo-write-pin weight=20
|
||||
//% blockId=device_set_servo_pin block="servo write|pin %name|to %value" blockGap=8 shim=pins::servoWritePin
|
||||
//% blockId=device_set_servo_pin block="servo write|pin %name|to %value" blockGap=8
|
||||
//% parts=microservo trackArgs=0 shim=pins::servoWritePin
|
||||
function servoWritePin(name: AnalogPin, value: number): void;
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user