The linear actuator being used it:
http://www.firgelliauto.com/product_info.php?cPath=82&products_id=52The problem we are having is that when the joystick is pushed +y, the linear actuator pushes forward, we did that correctly. However, ideally when in the normal state (joystick is in center) the actuator retracts. Then we will have another actuator set up for -y movement applied to the brake. We cannot configure how to have the actuator retract when in steady state. Normally to make the actuator retract we need to apply negative voltage.
The code being used so far is:
* LED attached from pin 13 to ground
* joystick attached to pin 12 from +5V
int buttonPin = 12; // the number of the pushbutton pin
int actuator = 13; // the number of the LED pin
int buttonState = 0;
void setup() {
// initialize the LED pin as an output:
pinMode(actuator, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
}
void loop(){
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);
// check if the pushbutton is not pressed.
// if it is, the buttonState is LOW:
if (buttonState == LOW) {
// turn LED off:
digitalWrite(actuator, LOW);
}
else {
// turn LED on:
digitalWrite(actuator, HIGH);
}
}