Update:
Here is my first try based on the code I found and it did not work.
The first time I uploaded it, it move to the "current positional value". But did not do the void loop part. Just holds the positions.
Thanks.
//Includes
#include <Servo.h>
//Defines
#define LINEAR_1_100PIN 11 //Linear Actuator Digital Pin
#define LINEAR_2_100PIN 6 //Linear Actuator Digital Pin
String msg;
//max/min pulse values in microseconds for the linear actuators
#define LINEAR_1_100_MIN 1050 //
#define LINEAR_1_100_MAX 2000 //
#define LINEAR_2_100_MIN 1050 //
#define LINEAR_2_100_MAX 2000 //
Servo LINEAR_1_100, LINEAR_2_100; // create servo objects to control the linear actuators
//int knobValue, sliderValue; //variables to hold the last reading from the analog pins
int linear100Value_1 = 1051; //current positional value being sent to the linear actuator.
int linear100Value_2 = 1051; //current positional value being sent to the linear actuator.
int speed = 10;
void setup()
{
//initialize servos
LINEAR_1_100.attach(LINEAR_1_100PIN, LINEAR_1_100_MIN, LINEAR_1_100_MAX); // attaches/activates the linear actuator as a servo object
LINEAR_2_100.attach(LINEAR_2_100PIN, LINEAR_2_100_MIN, LINEAR_2_100_MAX); // attaches/activates the linear actuator as a servo object
//Analog pins do not need to be initialized
//use the writeMicroseconds to set the linear actuators to their default positions
LINEAR_1_100.writeMicroseconds(linear100Value_1);
LINEAR_2_100.writeMicroseconds(linear100Value_2);
}
void loop()
{
LINEAR_1_100.writeMicroseconds(1800);
LINEAR_1_100.writeMicroseconds(1051);
delay(2000);
LINEAR_2_100.writeMicroseconds(1800);
LINEAR_2_100.writeMicroseconds(1051);
}
Old Question:
I am trying to make the code described in this tutorial: