Help needed!

I'm making my first program, and I'm making it before I buy the board to be sure it runs correctly and I don't waste money...

The compiler sends me an error message, but I can't find what is wrong...

The program have to move 4 motors with the variable impulse of 4 respective potentiometers, here is the sketch:

const int servopina=3; //output pin numbers
const int servopinb=5;
const int servopinc=6;
const int servopind=9;
const int inpina=0; //input pin numbers
const int inpinb=1;
const int inpinc=2;
const int inpind=3;
int storea=0; //input storing variables
int storeb=0
int storec=0
int stored=0

void setup() {
pinMode(servopina, OUTPUT);
pinMode(servopinb, OUTPUT);
pinMode(servopinc, OUTPUT);
pinMode(servopind, OUTPUT);
pinMode(inpina, INPUT);
pinMode(inpinb, INPUT);
pinMode(inpinc, INPUT);
pinMode(inpind, INPUT);
}

void loop() {
storea=analogRead(inpina);
storeb=analogRead(inpinb);
storec=analogRead(inpinc);
stored=analogRead(inpind);
map(storea, 0, 1023, 0, 254);
map(storeb, 0, 1023, 0, 254);
map(storec, 0, 1023, 0, 254);
map(stored, 0, 1023, 0, 254);
analogWrite(servopina, storea);
analogWrite(servopinb, storeb);
analogWrite(servopinc, storec);
analogWrite(servopind, stored);
}

I chose the pin numbers with the help of the description of an Arduino 2009 that said these pins where the analog input and PWM ones...

The error the compiler sends is this:

error: expected unqualified-id before numeric constant In function 'void loop()':
Bad error line: -2

What does this mean? How can I make this run correctly?
Thank you to everyone that will help!

ps: Sorry for the possible grammatical errors, but I'm not anglophone, and I'm not too good in it...

int storea=0; //input storing variables
int storeb=0
int storec=0
int stored=0

semicolons?

BTW, unless there's going to be something that means these should be globals, you may as well declare them in "loop"

In fact, you don't need them at all:

storea=analogRead(inpina);
 storeb=analogRead(inpinb);
 storec=analogRead(inpinc);
 stored=analogRead(inpind);
 map(storea, 0, 1023, 0, 254);
 map(storeb, 0, 1023, 0, 254);
 map(storec, 0, 1023, 0, 254);
 map(stored, 0, 1023, 0, 254);
 analogWrite(servopina, storea);
 analogWrite(servopinb, storeb);
 analogWrite(servopinc, storec);
 analogWrite(servopind, stored);

becomes:

 analogWrite(servopina, map(analogRead(inpina), 0, 1023, 0, 254));
 analogWrite(servopinb,  map(analogRead(inpinb), 0, 1023, 0, 254));
 analogWrite(servopinc,  map(analogRead(inpinc), 0, 1023, 0, 254));
 analogWrite(servopind,  map(analogRead(inpind), 0, 1023, 0, 254));

...or even smaller with a simple constant array and a loop.

These:

 pinMode(inpina, INPUT);
 pinMode(inpinb, INPUT);
 pinMode(inpinc, INPUT);
 pinMode(inpind, INPUT);

are unnecessary; analogue inputs are, well, inputs! :smiley:

I hope those aren't R/C servos you're driving with those "analogWrite"s..tut-tut

Thank you, it is absurd that I haven't found in half an hour 3 missing semicolons, now the compiler says it's right! D:

I know that inputs don't have to be declared, but I was trying everythig to make this program work XD

I hope those aren't R/C servos you're driving with those "analogWrite"s..tut-tut

I'm making it before I buy the board

While you may succeed in making a program compile, your program is unlikely to be correct. You won't find logic errors until you have it running in hardware.

Just a thought. :wink:

 pinMode(inpina, INPUT);

pinMode(inpinb, INPUT);
pinMode(inpinc, INPUT);
pinMode(inpind, INPUT);



are unnecessary;

But explicit, and might become necessary in the future :slight_smile:

But explicit, and might become necessary in the future

In which case, a new numbering scheme will be needed, or new "pinMode"s will be required.
They're analogue, remember. :wink: