Car project

I am making a program and arduino project, in which a front wheel and axle is controlled by a servo, and turning depending on the reading of one potentiometer, and the back wheel and axle controlled by the motor, which has its speed determined by another potentiometer. I made a program for this, and constructed the circuits, combining the servo circuit, 2 potentiometer circuits, and the motor circuit, all from the vilros arduino kit. As for my program, which practically combines the codes as well found on, which can be downloaded, it keeps returning the error " stray ‘/302’ in program ". Here is my program:
#include <Servo.h> // servo library

Servo servo1; // servo control object

void setup()
} //error appears here

void loop()
int sensorValue = analogRead(A0);//reads servo petentiometer
// print out the value you read:

servo1.write(sensorValue * 180L / 1023L); //servo output

int sensorValue2 = analogRead(A1);//reads motor petentiometer
// print out the value you read:

analogWrite(A2, (sensorValue2 * 130L / 1023L) + 125L); //motor output

Thanks for your solution :slight_smile: .

That compiles fine for me, for UNO in IDE V1.6.5.

In future, please post you code within [code]code tags[/code], rather than inline. :)

Edit: It might be a character in your code that is fixed when posted on the forum. If the error persists, you could try copying the code back out of your post into the IDE and see if it then compiles without errors. I seem to remember someone curing this problem like that once before.


Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.,148850.0.html
then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Also what version IDE are you using?

Thanks… Tom… :slight_smile: