error: expected initializer before ‘void’ I know most of the time this error is a missing ;
Below is my code.
void GetRxCommands()
{
static int LastChannel7Command;
// We always check the channel 7
Channel7Command = GetChannel7Command();
while(Failsafe)
{
if (DEBUG) Serial.println("RX Disconnected!");
ToggleAllLights(); // If the receiver isn't connected, pause the program and flash all the lights
delay(50);
GetChannel7Command();
}
if (Channel7Present) { Channel7 = GetChannel7Command();}
else { Channel7 = Pos1; } // We set Channel 7 to Position 1 if not being used
if (GearPresent) { GearCommand = GetGearCommand(); }
else { GearCommand = 0; } // We set Gear to nothing if not being used
}
boolean CheckGear()
{
GearPulse = pulseIn(Gear_Pin, HIGH, ServoTimeout);
if (GearPulse == 0) { return false; }
else { return true; }
}
int GetChannel7Command()
{
int Channel7Command;
Channel7Pulse = pulseIn(Channel7_Pin, HIGH, ServoTimeout);
if (Channel7Pulse == 0)
{ // In this case, there was no signal found
// Channel7Present = false;
Channel7Command = Pos3; // If no Channel7, we always set the mode to 1
}
else
{
Channel7Present = true;
if (Channel7Reverse == false)
{
if (Channel7Pulse > Channel7PulseCenter + 100)
{
Channel7Command = Pos3;
}
else if ((Channel7Pulse >= (Channel7PulseCenter - 100)) && (Channel7Pulse <= (Channel7PulseCenter + 100)))
{
Channel7Command = Pos2;
}
else
{
Channel7Command = Pos1;
}
}
else
{
if (Channel7Pulse > Channel7PulseCenter + 100)
{
Channel7Command = Pos1;
}
else if ((Channel7Pulse >= (Channel7PulseCenter - 100)) && (Channel7Pulse <= (Channel7PulseCenter + 100)))
{
Channel7Command = Pos2;
}
else
{
Channel7Command = Pos3;
}
}
}
return Command;
}
int GetGearCommand()
{
int GearCommand;
GearPulse = pulseIn(Gear_Pin, HIGH, ServoTimeout);
if (GearPulse == 0)
{ // In this case, there was no signal found
// GearPresent = false;
GearCommand = Pos1; // If no Gear, we always set the mode to 1
}
else
{
GearPresent = true;
if (GearReverse == false)
{
if (GearPulse > GearPulseCenter + 100)
{
GearCommand = Pos2;
}
else if ((GearPulse >= (GearPulseCenter - 100)) && (GearPulse <= (GearPulseCenter + 100)))
{
GearCommand = Pos1;
}
}
}
else
{
if (GearPulse > GearPulseCenter + 100)
{
GearCommand = Pos1;
}
else if ((GearPulse >= (GearPulseCenter - 100)) && (GearPulse <= (GearPulseCenter + 100)))
{
GearCommand = Pos2;
}
}
}
return GearCommand;
}