I am getting this error while compiling and I'm not sure why. I'm new to arduino, so go easy on me. Please advise, thanks!!
error:
uav_payload_receiver:33: error: expected primary-expression before '||' token
if(input == 0000) || (digitalRead(10) == LOW) {//if off code is received and no test button, all off and servo to 90
^
uav_payload_receiver:43: error: 'input' was not declared in this scope
if(input == 1111){//if on code is received
^
Using library SoftwareSerial at version 1.0 in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SoftwareSerial
Using library Servo at version 1.1.2 in folder: C:\Program Files (x86)\Arduino\libraries\Servo
exit status 1
expected primary-expression before '||' token
/*
5 channel remote receiver for UAV tooling. 1
servo rotator and 4 power FETs
Author Paul Sneed
based on:
HC-12 Momentary Button Receive
Author Tom Heylen tomtomheylen.com
*/
#include <SoftwareSerial.h>
#include <Servo.h>
SoftwareSerial mySerial(0, 1); // RX, TX
Servo servo_9;
void setup()
{
mySerial.begin(9600);
pinMode(10, INPUT);
pinMode(13, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
servo_9.attach(9);
}
void loop() {
if(mySerial.available() > 1){
int input = mySerial.parseInt();//read serial input and convert to integer (-32,768 to 32,767)
if(input == 0000) || (digitalRead(10) == LOW) {//if off code is received and no test button, all off and servo to 90
digitalWrite(13, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
servo_9.write(90);
delay(20); // Wait for 20 millisecond(s)
}
}
if(input == 1111){//if on code is received
// take code 1111 to rotate servo45
digitalWrite(13, HIGH);
servo_9.write(45);
delay(20); // Wait for 20 millisecond(s)
} else {
if(input == 2222) {
// take code 2222 to turn on FET2
digitalWrite(13, HIGH);
digitalWrite(4, HIGH);
delay(20); // Wait for 20 millisecond(s)
} else {
if(input == 3333) {
// take code 3333 to turn on FET3
digitalWrite(13, HIGH);
digitalWrite(5, HIGH);
delay(20); // Wait for 20 millisecond(s)
} else {
if(input == 4444) {
digitalWrite(13, HIGH);
digitalWrite(6, HIGH);
delay(20); // Wait for 20 millisecond(s)
} else {
if(input == 5555) {
digitalWrite(13, HIGH);
digitalWrite(7, HIGH);
delay(20); // Wait for 20 millisecond(s)
} else {
if (digitalRead(10) == HIGH) {
// test button, all fets on and servo45
servo_9.write(45);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, HIGH);
digitalWrite(13, HIGH);
delay(20); // Wait for 20 millisecond(s)
}
}
}
}
}
}
mySerial.flush();//clear the serial buffer for unwanted inputs
delay(20);//delay little for better serial communication
}