Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
/* Firgelli Automations
* Limited or no support: we do not have the resources for Arduino code support
* Program demos how a motor driver controls direction & speed of a linear actuator
int RPWM = 10; //connect Arduino pin 10 to IBT-2 pin RPWM
int LPWM = 11; //connect Arduino pin 11 to IBT-2 pin LPWM
int Speed;
void setup() {
pinMode(RPWM, OUTPUT);
pinMode(LPWM, OUTPUT);
void loop() {
Speed = 255; //choose any speed in the range [0,255]
analogWrite(RPWM, 0);
analogWrite(LPWM, Speed);
delay(1000); //extend at given speed for one second
analogWrite(RPWM, 0);
analogWrite(LPWM, 0);
delay(500); //stop for half a second
analogWrite(RPWM, Speed);
analogWrite(LPWM, 0);
delay(1000); //retract at maximum speed for one second
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment