Serial Receiving Error, Please Help!

HI, I am doing the RC receiver to control the ESC using the Servo Library. The transmitter will send the serial that satart with “$” to make the receiver know it is the beginning of the new serial before they execute each of the digits of the serial, which stands for the commands for different ESCs.

Please not that I didn’t account for ASCII convertion thta require me to subtract the read data with “0”, so I will get the original number from the transmitter. The error message said the following.

Receiver_Final.ino: In function 'void loop()':
Receiver_Final:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
Receiver_Final:28: error: expected '(' before 'valGSide'
Receiver_Final:33: error: expected '}' before 'else'
Receiver_Final:33: error: expected '(' before 'valGSide'
Receiver_Final:35: error: 'valWR' was not declared in this scope
Receiver_Final:36: error: 'valWL' was not declared in this scope
Receiver_Final:36: error: 'valGSide' was not declared in this scope
Receiver_Final:38: error: 'else' without a previous 'if'
Receiver_Final:38: error: expected '(' before 'valGSide'
Receiver_Final:40: error: 'valWL' was not declared in this scope
Receiver_Final:41: error: 'valWR' was not declared in this scope
Receiver_Final:41: error: 'valGSide' was not declared in this scope
Receiver_Final:44: error: 'valWL' was not declared in this scope
Receiver_Final:44: error: too few arguments to function 'long int map(long int, long int, long int, long int, long int)'
In file included from Receiver_Final.ino:3:0:
/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Arduino.h:245:6: note: declared here
 long map(long, long, long, long, long);
      ^
Receiver_Final:45: error: 'valWR' was not declared in this scope
Receiver_Final:45: error: too few arguments to function 'long int map(long int, long int, long int, long int, long int)'
In file included from Receiver_Final.ino:3:0:
/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Arduino.h:245:6: note: declared here
 long map(long, long, long, long, long);
      ^
Receiver_Final:47: error: 'valSide' was not declared in this scope
Receiver_Final:48: error: 'valUp' was not declared in this scope
Receiver_Final:50: error: 'valForward' was not declared in this scope
Receiver_Final.ino: At global scope:
Receiver_Final:55: error: expected declaration before '}' token
ISO C++ forbids comparison between pointer and integer [-fpermissive]

Here is the code. Thanks for helping by the way!

#include <Servo.h>

Servo Side, Up, Down, Forward, WL, WR;

void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);
Side.attach(13);
Up.attach(12);
Down.attach(11);
Forward.attach(10);
WL.attach(9);
WR.attach(8);
}

void loop() {
  // put your main code here, to run repeatedly:
if (Serial.available() == "$") 
{
int valUp = map (Serial.read(), 0, 9, 60, 180);
int valForward = map (Serial.read(), 0, 9, 60, 180);
int valSide = map (Serial.read(), 0, 9, 60, 180);
int valGForward = map (Serial.read(), 0, 9, 60, 180);
int valGSide = Serial.read();
int valWL=0;
int valWR=0;

if valGSide = 5;
{
  valWL= 9;
  valWR= 9;
}
else if valGSide < 5;
{
  valWR =9;
  valWL = 9-(valGSide*2);
}
else if valGSide > 5;
{
  valWL =9;
  valWR = 9-(valGSide*2);
}
  
valWL = map (0,9,0,180);
valWR = map (0,9,0,180);

Side.write(valSide);
Up.write(valUp);
Down.write(valUp);
Forward.write(valForward);
WL.write(valWL);
WR.write(valWR);

}
}
if (Serial.available() == "$")

no... it doesn't work like that. available() returns number of bytes in the serial buffer.

How can you possibly have an error receiving serial data, when you can't even compile the code that supposedly will receive serial data?

if (Serial.available() == "$")

The available() method tells you how many bytes are available to be read. What is the likelihood that the number of bytes to be read will equal the string literal? Not a snowball's chance in hell.

int valUp = map (Serial.read(), 0, 9, 60, 180);

What is sending this data? You may be reading a value that has not arrived (-1) and then mapping that out-of-range value as though it meant something.

if valGSide = 5;

Too much nonsense here to even begin trying to help. Missing parentheses. Useless semicolon. Incorrect operator.

valWL = map (0,9,0,180);
valWR = map (0,9,0,180);

map() takes 5 arguments.

check out Serial Input Basics to help you handle the data through the serial stream

Don't despair - unless you are a "software guru" as some folks on this forum think they are, it is normal that your code will not compile at first try. The compiler is your friend and will let you know pretty close where your coding errors are. Compiler usually reports typos or wrong syntax errors. If you do not understand the error, which can be pretty cryptic, this forum is THE PLACE to ask for clarification / help. Small advise - choosing correct title for your post can also help. With misleading title you risk getting "I am starter than you" repossess which you have already experienced.

Back up to the first error and read the description of "Serial" function "available", fix that, recompile and chase another error down until it compiles.

Than check your code logic. Does it really fails "receiving serial"? Good luck.

Thank You by the way, all of you. For the compiling error, is it from not plugging in the Arduino?

Another thing, thanks for that little advice about the forum tip, by the way, Vaclav.

Suphanat_Is: Thank You by the way, all of you. For the compiling error, is it from not plugging in the Arduino?

No, you can use "czech" - the first icon from left in IDE with check mark on it, to verify / compile your code without being connected to Arduino.