I got this code from the company that sold me the linear actuator that the code is controlling , I seem to be getting and error message on the void loop line
I played with it for 30 minutes or so with no luck obviously i am missing something very simple
Arduino: 1.8.5 (Mac OS X), Board: "Arduino/Genuino Uno"
/Users/gregorymorin/Desktop/linear_activator_/linear_activator_.ino: In function 'void setup()':
linear_activator_:6: error: a function-definition is not allowed here before '{' token
void setup() {
^
linear_activator_:16: error: a function-definition is not allowed here before '{' token
void loop() {
^
linear_activator_:34: error: expected '}' at end of input
}
^
exit status 1
a function-definition is not allowed here before '{' token
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
here is the code
void setup() {
// put your setup code here, to run once:
const int forwards = 7;
const int backwards = 6;//assign relay INx pin to arduino pin
void setup() {
pinMode(forwards, OUTPUT);//set relay as an output
pinMode(backwards, OUTPUT);//set relay as an output
}
void loop() {
digitalWrite(forwards, LOW);
digitalWrite(backwards, HIGH);//Activate the relay one direction, they must be different to move the motor
delay(2000); // wait 2 seconds
digitalWrite(forwards, HIGH);
digitalWrite(backwards, HIGH);//Deactivate both relays to brake the motor
delay(2000);// wait 2 seconds
digitalWrite(forwards, HIGH);
digitalWrite(backwards, LOW);//Activate the relay the other direction, they must be different to move the motor
delay(2000);// wait 2 seconds
digitalWrite(forwards, HIGH);
digitalWrite(backwards, HIGH);//Deactivate both relays to brake the motor
delay(2000);// wait 2 seconds
}