Newbie Scetch help

Good day

Please help me fix this code to maker it compile & work.

I get the following error when I compile my scetch: "ISO C++ forbids comparison between pointer and integer"

Here is the scetch:

int command = 0 ;

void setup() {
  // put your setup code here, to run once:
  delay(1000);          // wait a bit before starting
  Serial.begin(115200);   // set up Serial library at 9600 bps
}

void loop() {
  // put your main code here, to run repeatedly: 
    if (Serial.available() > 0) {
    command = Serial.read();
    if (command == "1")
	//pan left
    if (command == "2")
	//pan center
    if (command == "3")
	//pan right
    if (command == "4")
	//tilt up
    if (command == "5")
	//tilt center
    if (command == "6")
	//tilt down
    
    command = 0;  
}
}

The error is displayed first on the following line: if (command == "1")

(command == '1')

NB single quotes.

"ISO C++ forbids comparison between pointer and integer"

"command" is the integer, and in your version, "1" is a string, so is represented by a pointer.

Good day

Thank you very much for your help.
Will this change still be able to read the serial port data beeing sent to my Arduino?

Thanks
Riaan Deyzel

Yes.
'1' is the integer value 49 decimal, 0x31

Thank you very much.

I will try it this weekend.
I am busy playing around with apps that moves servo's around, and this code will be used for the following example.

http://arduino.cc/forum/index.php/topic,55429.0.html

Pitty the "Here is that example slightly modifed to have more buttons" project it is not in c# source code with scetch, but as they say, beggars can't be choosers.

Thanks again for the help.

Use single quotes to read the ASCII value not double quotes...Double quotes are used to print or scan the string...