GPIO driver for Servos
Introduction
The GPIO driver for Servos uses a special form of PWM to control servos from the Builder Base. The selected pin includes an optional initial value.
Driver Parameters
The GPIO driver for Digital Inputs has one parameter that have to be configured:
Pin
Any GP pin on the Builder Base if not already used
Wiring
Example
The GP0 pin on the Builder Base is directly connected to the pulse pin on the Servo. The 5v and GND lines are then connected between the Builder Base and the Servo.
Breadboard
Schematic
Used Pins
Used Pins | Description |
---|---|
5v | The voltage level for the assembly |
GND | The ground potential for the assembly |
GP0 (can be any GP pin) | The GP output pin |
How to write an App
Navigate to the App Builder and create a new application. You can find the “Servo” code object under the “Hardware” Tab in the object drop down menu on the left, or you can also use the search bar.
Drag the “Servo” Object onto the canvas.
Next, locate the “Input Number” Object under the Interface tab and drag three instances of it onto the canvas.
Finally, connect the “Number” port from one of each of the Input Number Objects to the “Degrees”, “Offsets”, and “180 Offsets” ports on the Servo Object and save your application.
How to create a firmware
Navigate to the Firmware Builder and create a new firmware file.
Click the “+ Add Hardware” button which will open a modal window. Search or scroll down in the list and under “Actuators” select the “Servo” hardware option.
Give your device a name, and click “Add Device”
Next, select the “GPIO” driver under the driver dropdown menu, set the Pin.
For this example we select:
Pin: GP0
You may now save your firmware file and upload it to one of your clients.
Supported Hardware
Servos
Downloads
Apps
Firmware
Assets