user10974: I am Creating a laptop controlled robot using an arduino nano using the instructbles. I have tried running the code but it is throwing back lots off error and the main one is "expected primary expression before "<" token"
as well as various other error. if anyone could take a look and try help me out i would be grateful thank you!
#include <NewPing.h>

#include <LiquidCrystal.h>

LiquidCrystal lcd(11, 8, 7, 4, 3, 2);
float temp =1;
int temppin = A0;
int r_motor_n = 9; //PWM control Right Motor +
int r_motor_p = 10; //PWM control Right Motor -
int l_motor_p = 6; //PWM control Left Motor -
int l_motor_n = 5; //PWM control Left Motor +
int f_light = A3;
int b_light = A4;
int horn = 12;
int n_light = 13;
int speedy = 255;
int incomingByte = 0; // for incoming serial data
#define TRIGGER A2 // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO A1 // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX 400 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.
NewPing sonar(TRIGGER, ECHO, MAX); // NewPing setup of pins and maximum distance.
void setup()
{
pinMode(r_motor_n, OUTPUT); //Set control pins to be outputs
pinMode(r_motor_p, OUTPUT);
pinMode(l_motor_p, OUTPUT);
pinMode(l_motor_n, OUTPUT);
pinMode(f_light, OUTPUT);
pinMode(b_light, OUTPUT);
pinMode(n_light, OUTPUT);
pinMode(horn, OUTPUT);
digitalWrite(r_motor_n, LOW); //set both motors off for start-up
digitalWrite(r_motor_p, LOW);
digitalWrite(l_motor_p, LOW);
digitalWrite(l_motor_n, LOW);
Serial.begin(9600);
Serial.println("Start");
lcd.begin(16,2);
lcd.clear();
lcd.print("     Hello      ");
lcd.setCursor(0,1);
lcd.print("   I'm Robot   ");
delay(3000);
}
void loop()
{</liquidcrystal.h></newping.h></p><p>if (Serial.available() > 0) 
{
incomingByte = Serial.read();
}</p><p>switch(incomingByte)
{</p><p>case 'S': // control to stop the robot
digitalWrite(r_motor_n, LOW); 
digitalWrite(r_motor_p, LOW);
digitalWrite(l_motor_p, LOW);
digitalWrite(l_motor_n, LOW);
Serial.println("Stop");
lcd.clear();
lcd.print("Stop");
incomingByte='*';
break;</p><p>case 'R': //control for right
analogWrite(r_motor_n, speedy); 
digitalWrite(r_motor_p, LOW);
analogWrite(l_motor_p, speedy);
digitalWrite(l_motor_n, LOW);
Serial.println("right");
lcd.clear();
lcd.print("Right");
incomingByte='*';
break;</p><p>case 'L': //control for left
digitalWrite(r_motor_n, LOW); 
analogWrite(r_motor_p, speedy);
digitalWrite(l_motor_p, LOW);
analogWrite(l_motor_n, speedy);
Serial.println("left");
lcd.clear();
lcd.print("Left");
incomingByte='*';
break;</p><p>case 'F': //control for forward
analogWrite(r_motor_n, speedy); 
digitalWrite(r_motor_p, LOW);
digitalWrite(l_motor_p, LOW);
analogWrite(l_motor_n, speedy);
Serial.println("forward");
lcd.clear();
lcd.print("Forward");
incomingByte='*';
break;</p><p>case 'B': //control for backward
digitalWrite(r_motor_n, LOW); 
analogWrite(r_motor_p, speedy);
analogWrite(l_motor_p, speedy);
digitalWrite(l_motor_n, LOW);
Serial.println("backwards");
lcd.clear();
lcd.print("Backward");
incomingByte='*';
break;</p><p>case 'f': //control for stop
digitalWrite(r_motor_n, LOW);
digitalWrite(r_motor_p, LOW);
digitalWrite(l_motor_p, LOW);
digitalWrite(l_motor_n, LOW);
Serial.println("Stop");
lcd.clear();
lcd.print("Stop");
incomingByte='*';
break;</p><p>case 'd': // control for right
analogWrite(r_motor_n, speedy); 
digitalWrite(r_motor_p, LOW);
analogWrite(l_motor_p, speedy);
digitalWrite(l_motor_n, LOW);
Serial.println("right");
lcd.clear();
lcd.print("Right");
incomingByte='*';
break;</p><p>case 'a': // control for left
digitalWrite(r_motor_n, LOW); 
analogWrite(r_motor_p, speedy);
digitalWrite(l_motor_p, LOW);
analogWrite(l_motor_n, speedy);
Serial.println("left");
lcd.clear();
lcd.print("Left");
incomingByte='*';
break;</p><p>case 'w': // control for forward
analogWrite(r_motor_n, speedy); 
digitalWrite(r_motor_p, LOW);
digitalWrite(l_motor_p, LOW);
analogWrite(l_motor_n, speedy);
Serial.println("forward");
lcd.clear();
lcd.print("Forward");
incomingByte='*';
break;</p><p>case 's': // control for backward
digitalWrite(r_motor_n, LOW); 
analogWrite(r_motor_p, speedy);
analogWrite(l_motor_p, speedy);
digitalWrite(l_motor_n, LOW);
Serial.println("backwards");
lcd.clear();
lcd.print("Backward");
incomingByte='*';
break;</p><p>case 'J': // front lights on
digitalWrite(f_light, HIGH);
Serial.println("front lights on");
incomingByte='*';
break;</p><p>case 'j':
digitalWrite(f_light, LOW); // off
Serial.println("front lights off");
incomingByte='*';
break;</p><p>case 'K':
digitalWrite(b_light, HIGH); // back lights on
Serial.println("back lights on");
incomingByte='*';
break;</p><p>case 'k':
digitalWrite(b_light, LOW); // off
Serial.println("back lights off");
incomingByte='*';
break;</p><p>case 'G':
digitalWrite(n_light, HIGH); // neon lights on
Serial.println("neon lights on");
incomingByte='*';
break;</p><p>case 'g':
digitalWrite(n_light, LOW); off
Serial.println("neon lights off");
incomingByte='*';
break;</p><p>case 'H':
digitalWrite(horn, HIGH); // horn on
Serial.println("horn on");
incomingByte='*';
break;</p><p>case 'h':
digitalWrite(horn, LOW); off
Serial.println("horn off");
incomingByte='*';
break;</p><p>case 'O': // PWM speed values
speedy = 0 ;
Serial.println("speed= 0");
lcd.clear();
lcd.print("Speed=0");
incomingByte='*';
break;</p><p>case '1':
speedy = 155;
Serial.println("speed= 10");
lcd.clear();
lcd.print("Speed=10");
incomingByte='*';
break;</p><p>case '2':
speedy = 165;
Serial.println("speed= 20");
lcd.clear();
lcd.print("Speed=20");
incomingByte='*';
break;</p><p>case '3':
speedy = 175;
Serial.println("speed= 30");
lcd.clear();
lcd.print("Speed =30");
incomingByte='*';
break;</p><p>case '4':
speedy = 185;
Serial.println("speed= 40");
lcd.clear();
lcd.print("Speed=40");
incomingByte='*';
break;</p><p>case '5':
speedy = 195;
Serial.println("speed= 50");
lcd.clear();
lcd.print("Speed=50");
incomingByte='*';
break;</p><p>case '6':
speedy = 205;
Serial.println("speed= 60");
lcd.clear();
lcd.print("Speed=60");
incomingByte='*';
break;</p><p>case '7':
speedy = 215;
Serial.println("speed= 70");
lcd.clear();
lcd.print("Speed=70");
incomingByte='*';
break;</p><p>case '8':
speedy = 225;
Serial.println("speed= 80");
lcd.clear();
lcd.print("Speed=80");
incomingByte='*';
break;</p><p>case '9':
speedy = 235;
Serial.println("speed= 90");
lcd.clear();
lcd.print("Speed=90");
incomingByte='*';
break;</p><p>case 'q':
speedy = 255;
Serial.println("speed= 100");
lcd.clear();
lcd.print("Speed=100");
incomingByte='*';
break;</p><p>case 'p': 
delay(50);  // display temp. and distance
unsigned int uS = sonar.ping(); 
Serial.print("Distance: ");
Serial.print(uS / US_ROUNDTRIP_CM); 
Serial.println("cm");
lcd.clear();
lcd.print("Distance: ");
lcd.print(uS / US_ROUNDTRIP_CM); 
lcd.print("cm");
lcd.setCursor(0,1);
temp = analogRead(temppin);
temp = temp * 0.48828125;
Serial.print("Temperature = ");
Serial.print(temp);
Serial.print("*C");
Serial.println();
lcd.print("Temp. = ");
lcd.print(temp);
lcd.print("*C");
delay(1000);
incomingByte='*';
break;</p><p>delay(5000);
}
}</p>


user7856: your code is ridden with html tags, like 
</p> <p> or </liquidcrystal.h></newping.h>
Try removing them all, but it would be better if you could copy it from a plain ASCII source.
And when reporting a compiler bug, it's always good to paste it exactly as it is shown (it would have listed also line and possibly column where the error was detected)

10974: <p>I am Creating a laptop controlled robot using an arduino nano using the <a href="http://www.instructables.com/id/Laptop-Controlled-Robot-v20/#step0" rel="nofollow">instructbles</a>. I have tried running the code but it is throwing back lots off error and the main one is "expected primary expression before "&lt;" token"</p>

<p>as well as various other error. if anyone could take a look and try help me out i would be grateful thank you!</p>

<pre><code>#include &lt;NewPing.h&gt;

#include &lt;LiquidCrystal.h&gt;

LiquidCrystal lcd(11, 8, 7, 4, 3, 2);
float temp =1;
int temppin = A0;
int r_motor_n = 9; //PWM control Right Motor +
int r_motor_p = 10; //PWM control Right Motor -
int l_motor_p = 6; //PWM control Left Motor -
int l_motor_n = 5; //PWM control Left Motor +
int f_light = A3;
int b_light = A4;
int horn = 12;
int n_light = 13;
int speedy = 255;
int incomingByte = 0; // for incoming serial data
#define TRIGGER A2 // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO A1 // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX 400 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.
NewPing sonar(TRIGGER, ECHO, MAX); // NewPing setup of pins and maximum distance.
void setup()
{
pinMode(r_motor_n, OUTPUT); //Set control pins to be outputs
pinMode(r_motor_p, OUTPUT);
pinMode(l_motor_p, OUTPUT);
pinMode(l_motor_n, OUTPUT);
pinMode(f_light, OUTPUT);
pinMode(b_light, OUTPUT);
pinMode(n_light, OUTPUT);
pinMode(horn, OUTPUT);
digitalWrite(r_motor_n, LOW); //set both motors off for start-up
digitalWrite(r_motor_p, LOW);
digitalWrite(l_motor_p, LOW);
digitalWrite(l_motor_n, LOW);
Serial.begin(9600);
Serial.println("Start");
lcd.begin(16,2);
lcd.clear();
lcd.print("     Hello      ");
lcd.setCursor(0,1);
lcd.print("   I'm Robot   ");
delay(3000);
}
void loop()
{&lt;/liquidcrystal.h&gt;&lt;/newping.h&gt;&lt;/p&gt;&lt;p&gt;if (Serial.available() &gt; 0) 
{
incomingByte = Serial.read();
}&lt;/p&gt;&lt;p&gt;switch(incomingByte)
{&lt;/p&gt;&lt;p&gt;case 'S': // control to stop the robot
digitalWrite(r_motor_n, LOW); 
digitalWrite(r_motor_p, LOW);
digitalWrite(l_motor_p, LOW);
digitalWrite(l_motor_n, LOW);
Serial.println("Stop");
lcd.clear();
lcd.print("Stop");
incomingByte='*';
break;&lt;/p&gt;&lt;p&gt;case 'R': //control for right
analogWrite(r_motor_n, speedy); 
digitalWrite(r_motor_p, LOW);
analogWrite(l_motor_p, speedy);
digitalWrite(l_motor_n, LOW);
Serial.println("right");
lcd.clear();
lcd.print("Right");
incomingByte='*';
break;&lt;/p&gt;&lt;p&gt;case 'L': //control for left
digitalWrite(r_motor_n, LOW); 
analogWrite(r_motor_p, speedy);
digitalWrite(l_motor_p, LOW);
analogWrite(l_motor_n, speedy);
Serial.println("left");
lcd.clear();
lcd.print("Left");
incomingByte='*';
break;&lt;/p&gt;&lt;p&gt;case 'F': //control for forward
analogWrite(r_motor_n, speedy); 
digitalWrite(r_motor_p, LOW);
digitalWrite(l_motor_p, LOW);
analogWrite(l_motor_n, speedy);
Serial.println("forward");
lcd.clear();
lcd.print("Forward");
incomingByte='*';
break;&lt;/p&gt;&lt;p&gt;case 'B': //control for backward
digitalWrite(r_motor_n, LOW); 
analogWrite(r_motor_p, speedy);
analogWrite(l_motor_p, speedy);
digitalWrite(l_motor_n, LOW);
Serial.println("backwards");
lcd.clear();
lcd.print("Backward");
incomingByte='*';
break;&lt;/p&gt;&lt;p&gt;case 'f': //control for stop
digitalWrite(r_motor_n, LOW);
digitalWrite(r_motor_p, LOW);
digitalWrite(l_motor_p, LOW);
digitalWrite(l_motor_n, LOW);
Serial.println("Stop");
lcd.clear();
lcd.print("Stop");
incomingByte='*';
break;&lt;/p&gt;&lt;p&gt;case 'd': // control for right
analogWrite(r_motor_n, speedy); 
digitalWrite(r_motor_p, LOW);
analogWrite(l_motor_p, speedy);
digitalWrite(l_motor_n, LOW);
Serial.println("right");
lcd.clear();
lcd.print("Right");
incomingByte='*';
break;&lt;/p&gt;&lt;p&gt;case 'a': // control for left
digitalWrite(r_motor_n, LOW); 
analogWrite(r_motor_p, speedy);
digitalWrite(l_motor_p, LOW);
analogWrite(l_motor_n, speedy);
Serial.println("left");
lcd.clear();
lcd.print("Left");
incomingByte='*';
break;&lt;/p&gt;&lt;p&gt;case 'w': // control for forward
analogWrite(r_motor_n, speedy); 
digitalWrite(r_motor_p, LOW);
digitalWrite(l_motor_p, LOW);
analogWrite(l_motor_n, speedy);
Serial.println("forward");
lcd.clear();
lcd.print("Forward");
incomingByte='*';
break;&lt;/p&gt;&lt;p&gt;case 's': // control for backward
digitalWrite(r_motor_n, LOW); 
analogWrite(r_motor_p, speedy);
analogWrite(l_motor_p, speedy);
digitalWrite(l_motor_n, LOW);
Serial.println("backwards");
lcd.clear();
lcd.print("Backward");
incomingByte='*';
break;&lt;/p&gt;&lt;p&gt;case 'J': // front lights on
digitalWrite(f_light, HIGH);
Serial.println("front lights on");
incomingByte='*';
break;&lt;/p&gt;&lt;p&gt;case 'j':
digitalWrite(f_light, LOW); // off
Serial.println("front lights off");
incomingByte='*';
break;&lt;/p&gt;&lt;p&gt;case 'K':
digitalWrite(b_light, HIGH); // back lights on
Serial.println("back lights on");
incomingByte='*';
break;&lt;/p&gt;&lt;p&gt;case 'k':
digitalWrite(b_light, LOW); // off
Serial.println("back lights off");
incomingByte='*';
break;&lt;/p&gt;&lt;p&gt;case 'G':
digitalWrite(n_light, HIGH); // neon lights on
Serial.println("neon lights on");
incomingByte='*';
break;&lt;/p&gt;&lt;p&gt;case 'g':
digitalWrite(n_light, LOW); off
Serial.println("neon lights off");
incomingByte='*';
break;&lt;/p&gt;&lt;p&gt;case 'H':
digitalWrite(horn, HIGH); // horn on
Serial.println("horn on");
incomingByte='*';
break;&lt;/p&gt;&lt;p&gt;case 'h':
digitalWrite(horn, LOW); off
Serial.println("horn off");
incomingByte='*';
break;&lt;/p&gt;&lt;p&gt;case 'O': // PWM speed values
speedy = 0 ;
Serial.println("speed= 0");
lcd.clear();
lcd.print("Speed=0");
incomingByte='*';
break;&lt;/p&gt;&lt;p&gt;case '1':
speedy = 155;
Serial.println("speed= 10");
lcd.clear();
lcd.print("Speed=10");
incomingByte='*';
break;&lt;/p&gt;&lt;p&gt;case '2':
speedy = 165;
Serial.println("speed= 20");
lcd.clear();
lcd.print("Speed=20");
incomingByte='*';
break;&lt;/p&gt;&lt;p&gt;case '3':
speedy = 175;
Serial.println("speed= 30");
lcd.clear();
lcd.print("Speed =30");
incomingByte='*';
break;&lt;/p&gt;&lt;p&gt;case '4':
speedy = 185;
Serial.println("speed= 40");
lcd.clear();
lcd.print("Speed=40");
incomingByte='*';
break;&lt;/p&gt;&lt;p&gt;case '5':
speedy = 195;
Serial.println("speed= 50");
lcd.clear();
lcd.print("Speed=50");
incomingByte='*';
break;&lt;/p&gt;&lt;p&gt;case '6':
speedy = 205;
Serial.println("speed= 60");
lcd.clear();
lcd.print("Speed=60");
incomingByte='*';
break;&lt;/p&gt;&lt;p&gt;case '7':
speedy = 215;
Serial.println("speed= 70");
lcd.clear();
lcd.print("Speed=70");
incomingByte='*';
break;&lt;/p&gt;&lt;p&gt;case '8':
speedy = 225;
Serial.println("speed= 80");
lcd.clear();
lcd.print("Speed=80");
incomingByte='*';
break;&lt;/p&gt;&lt;p&gt;case '9':
speedy = 235;
Serial.println("speed= 90");
lcd.clear();
lcd.print("Speed=90");
incomingByte='*';
break;&lt;/p&gt;&lt;p&gt;case 'q':
speedy = 255;
Serial.println("speed= 100");
lcd.clear();
lcd.print("Speed=100");
incomingByte='*';
break;&lt;/p&gt;&lt;p&gt;case 'p': 
delay(50);  // display temp. and distance
unsigned int uS = sonar.ping(); 
Serial.print("Distance: ");
Serial.print(uS / US_ROUNDTRIP_CM); 
Serial.println("cm");
lcd.clear();
lcd.print("Distance: ");
lcd.print(uS / US_ROUNDTRIP_CM); 
lcd.print("cm");
lcd.setCursor(0,1);
temp = analogRead(temppin);
temp = temp * 0.48828125;
Serial.print("Temperature = ");
Serial.print(temp);
Serial.print("*C");
Serial.println();
lcd.print("Temp. = ");
lcd.print(temp);
lcd.print("*C");
delay(1000);
incomingByte='*';
break;&lt;/p&gt;&lt;p&gt;delay(5000);
}
}&lt;/p&gt;
</code></pre>
 7856: <p>your code is ridden with html tags, like </p>

<p><code>&lt;/p&gt; &lt;p&gt;</code> or <code>&lt;/liquidcrystal.h&gt;&lt;/newping.h&gt;</code></p>

<p>Try removing them all, but it would be better if you could copy it from a plain ASCII source.</p>

<p>And when reporting a compiler bug, it's always good to paste it exactly as it is shown (it would have listed also line and possibly column where the error was detected)</p>
