Mini DFRobotShop Rover User Guide v1.0 sketch problem

Hi!
I have problems with all the sketches from the manual. None works in the review. I have very little idea of Arduino and at least wanted to get the mini rover to move, but that doesn’t work. As an example here the simplest sketch.
Similar errors for all skatech.

int E1 = 6; //M1 Speed Control
int E2 = 5; //M2 Speed Control
int M1 = 8; //M1 Direction Control
int M2 = 7; //M2 Direction Control
void setup()
{
int i;
for(i=5;i<=8;i++)
pinMode(i, OUTPUT);
Serial.begin(9600);
}
void loop()
{
int leftspeed = 255; //255 is maximum speed
int rightspeed = 255;
analogWrite (E1,255);
digitalWrite(M1,LOW);
analogWrite (E2,255);
digitalWrite(M2,LOW);
delay(100);
}

PROBLEMS

sketch_jun04c:7:10: error: stray '\315' in program
 #define i;
^
C:\Users\marko\Documents\Arduino\sketch_jun04c\sketch_jun04c.ino:8:5: note: in expansion of macro 'i'
 for(i=5;i<=8;i++)
^
sketch_jun04c:7:11: error: stray '\276' in program
 #define i;
^
C:\Users\marko\Documents\Arduino\sketch_jun04c\sketch_jun04c.ino:8:5: note: in expansion of macro 'i'
 for(i=5;i<=8;i++)
^
sketch_jun04c:8:8: error: stray '\315' in program
for(i=5;i<=8;i++)
^
sketch_jun04c:8:9: error: stray '\276' in program
for(i=5;i<=8;i++)
^
sketch_jun04c:7:10: error: stray '\315' in program
#define i;
^
C:\Users\marko\Documents\Arduino\sketch_jun04c\sketch_jun04c.ino:8:10: note: in expansion of macro 'i'
for(i=5;i<=8;i++)
^
sketch_jun04c:7:11: error: stray '\276' in program
#define i;
^
C:\Users\marko\Documents\Arduino\sketch_jun04c\sketch_jun04c.ino:8:10: note: in expansion of macro 'i'
for(i=5;i<=8;i++)
^
sketch_jun04c:8:14: error: stray '\315' in program
for(i=5;i<=8;i++)
^
sketch_jun04c:8:15: error: stray '\276' in program
for(i=5;i<=8;i++)
^
sketch_jun04c:7:10: error: stray '\315' in program
#define i;
^
C:\Users\marko\Documents\Arduino\sketch_jun04c\sketch_jun04c.ino:8:16: note: in expansion of macro 'i'
for(i=5;i<=8;i++)
^
sketch_jun04c:7:11: error: stray '\276' in program
#define i;
^
C:\Users\marko\Documents\Arduino\sketch_jun04c\sketch_jun04c.ino:8:16: note: in expansion of macro 'i'
for(i=5;i<=8;i++)
^
sketch_jun04c:7:10: error: stray '\315' in program
#define i;
^
C:\Users\marko\Documents\Arduino\sketch_jun04c\sketch_jun04c.ino:9:9: note: in expansion of macro 'i'
pinMode(i, OUTPUT);
^
sketch_jun04c:7:11: error: stray '\276' in program
#define i;
^
C:\Users\marko\Documents\Arduino\sketch_jun04c\sketch_jun04c.ino:9:9: note: in expansion of macro 'i'
pinMode(i, OUTPUT);
^
sketch_jun04c:9:19: error: stray '\315' in program
pinMode(i, OUTPUT);
^
sketch_jun04c:9:20: error: stray '\276' in program
pinMode(i, OUTPUT);
^
sketch_jun04c:10:19: error: stray '\315' in program
 Serial.begin(9600);
^
sketch_jun04c:10:20: error: stray '\276' in program
Serial.begin(9600);
^
sketch_jun04c:1:15: error: stray '\315' in program

#define E1 = 6; //M1 Speed Control
^
C:\Users\marko\Documents\Arduino\sketch_jun04c\sketch_jun04c.ino:14:14: note: in expansion of macro 'E1'
analogWrite (E1,255);
^~
sketch_jun04c:1:16: error: stray '\276' in program
#define E1 = 6; //M1 Speed Control
^
C:\Users\marko\Documents\Arduino\sketch_jun04c\sketch_jun04c.ino:14:14: note: in expansion of macro 'E1'
analogWrite (E1,255);
^~
sketch_jun04c:14:21: error: stray '\315' in program
analogWrite (E1,255);
^
sketch_jun04c:14:22: error: stray '\276' in program
analogWrite (E1,255);
^
sketch_jun04c:3:15: error: stray '\315' in program
 #define M1 = 8; //M1 Direction Control
^
C:\Users\marko\Documents\Arduino\sketch_jun04c\sketch_jun04c.ino:15:14: note: in expansion of macro 'M1'
digitalWrite(M1,LOW);
^~
sketch_jun04c:3:16: error: stray '\276' in program
#define M1 = 8; //M1 Direction Control
^
C:\Users\marko\Documents\Arduino\sketch_jun04c\sketch_jun04c.ino:15:14: note: in expansion of macro 'M1'
digitalWrite(M1,LOW);
^~
sketch_jun04c:15:21: error: stray '\315' in program
digitalWrite(M1,LOW);
^
sketch_jun04c:15:22: error: stray '\276' in program
digitalWrite(M1,LOW);
^
sketch_jun04c:2:15: error: stray '\315' in program
#define E2 = 5; //M2 Speed Control
^
C:\Users\marko\Documents\Arduino\sketch_jun04c\sketch_jun04c.ino:16:14: note: in expansion of macro 'E2'
analogWrite (E2,255);
^~
sketch_jun04c:2:16: error: stray '\276' in progra
#define E2 = 5; //M2 Speed Control
^
C:\Users\marko\Documents\Arduino\sketch_jun04c\sketch_jun04c.ino:16:14: note: in expansion of macro 'E2'
analogWrite (E2,255);
^~
sketch_jun04c:16:21: error: stray '\315' in program
analogWrite (E2,255);
^
sketch_jun04c:16:22: error: stray '\276' in program
analogWrite (E2,255);
^
sketch_jun04c:4:15: error: stray '\315' in program
#define M2 = 7; //M2 Direction Control
^
C:\Users\marko\Documents\Arduino\sketch_jun04c\sketch_jun04c.ino:17:14: note: in expansion of macro 'M2'
digitalWrite(M2,LOW);
^~
sketch_jun04c:4:16: error: stray '\276' in program
#define M2 = 7; //M2 Direction Control
^
C:\Users\marko\Documents\Arduino\sketch_jun04c\sketch_jun04c.ino:17:14: note: in expansion of macro 'M2'
digitalWrite(M2,LOW);
^~
sketch_jun04c:17:21: error: stray '\315' in program
digitalWrite(M2,LOW);
^
sketch_jun04c:17:22: error: stray '\276' in program
digitalWrite(M2,LOW);
^
sketch_jun04c:18:11: error: stray '\315' in program
delay(100);
^
sketch_jun04c:18:12: error: stray '\276' in program
delay(100);
^
C:\Users\marko\Documents\Arduino\sketch_jun04c\sketch_jun04c.ino: In function 'void setup()':
sketch_jun04c:8:6: error: expected primary-expression before '=' token
for(i=5;i<=8;i++
^
sketch_jun04c:8:17: error: lvalue required as increment operand
for(i=5;i<=8;i++)
^~
sketch_jun04c:11:1: error: expected primary-expression before '}' token
 }
^
sketch_jun04c:11:1: error: expected ';' before '}' token
sketch_jun04c:11:1: error: expected primary-expression before '}' token
sketch_jun04c:11:1: error: expected ')' before '}' token
sketch_jun04c:11:1: error: expected primary-expression before '}' token
C:\Users\marko\Documents\Arduino\sketch_jun04c\sketch_jun04c.ino: In function 'void loop()':
sketch_jun04c:1:12: error: expected primary-expression before '=' token
#define E1 = 6; //M1 Speed Control
^
C:\Users\marko\Documents\Arduino\sketch_jun04c\sketch_jun04c.ino:14:14: note: in expansion of macro 'E1
analogWrite (E1,255);
^~
exit status 1
stray '\315' in program

Thank you so much in advance for your help!

1 Like

@Kusi Welcome to the RobotShop Community! It’s a straightforward sketch with no external references, so it seems like perhaps the software confirgurations might be wrong.

  1. Which version of the Arduino IDE are you using?
  2. Did you choose the right board type?
  3. Did you select the appropriate COM port to which the rover is connected?
  4. What is powering the board (provide some clear photos if needed).
1 Like

@cbenson

  • Version of the Arduino IDE 1.8.12
  • Board type chosen Arduino Uno
  • COM port is correct

1 Like

@Kusi
Please try the attached ino file (in a ZIP, extract first).
RoverMini-test-2020-06-04.zip (638 Bytes)

This is just a copy of the code from the manual (same as yours, but it compiles normally).

Let me know if that works for you!

@scharette

Thanks it works, I think that there is a copy / past problem from the pdf to the Arduino IDE. Everything looks the same, but after copying from the pdf it doesn’t work.

Then I have to type all the other examples by hand :frowning:

Or can you send me the other examples as zip files, would be nice and save me a lot of work. :slight_smile:

1 Like

As a side note, I figured out your issue.
The compiler is complaining about invalid characters hence why you get:

The long list of errors all points to your ;. What happens is your ; are not actually normal ; but something else.

When I place your code in Notepad++ and search for ;, I find a count of 0!
image

As soon as I replace those with normal ;, everything compiles.

Therefore, whatever interface you are using to copy & paste from the PDF is not working (messing up the ;).
Simply find&replace those and it’ll work fine (or use a different PDF viewer).

Sincerely,

Can you send me the other examples as zip files, would be nice and save me a lot of work. :slight_smile:

1 Like

It’s a greek question mark (unicode U+037E) as opposed to a semicolon (unicode U+003B).

1 Like

Would you happen to be located in Greece? If not, it sounds like your Adobe would have a greek language installed which is causing the issue. First time ever hearing about this issue and happy we figured out what’s happening.

1 Like

I am in Germany and everything is set to German.
Very strange, with other pdf readers the same problem.

1 Like