1

I'm doing a project for school using Arduino to make a catapult, but I have this error that I didn't have the previous week.

Can anyone see the program and search where is the error?

#include <Servo.h> //libreria necesaria para utilizar el Servo

Servo catac; //motor de giro continuo utilizado

int ledPin = 13; //led conectado a agujero 13
int button = 8; //boton conectado a agujero 8
int estado = 0; //varaible que permite saber el estado del boton

void setup()
{
    pinMode(ledPin,OUTPUT); 
    pinMode(button,INPUT); 
    catac.attach(12); // servo unido al agujero 12
    catac.write(180); //coloca al servo en 180 grados
}

void loop()
{
    estado = digitalRead(button); //la variable obtiene el estado del boton
    if(estado == LOW)
    {
        digitalWrite(ledPin,HIGH); //prende led
        catac.write(70); //servo levanta a 70 grados la catapulta
        delay(500);
        digitalWrite(ledPin,LOW); //apaga led
        catac.write(180); //servo coloca a la catapulta en posicion original
    }
}

Error:

cataoukta:6: error: stray '\' in program
cataoukta:8: error: stray '\' in program
cataoukta:9: error: stray '\' in program
cataoukta:10: error: stray '\' in program
cataoukta:13: error: stray '\' in program
cataoukta:14: error: stray '\' in program
cataoukta:15: error: stray '\' in program
cataoukta:16: error: stray '\' in program
cataoukta:20: error: stray '\' in program
cataoukta:22: error: stray '\' in program
cataoukta:23: error: stray '\' in program
cataoukta:24: error: stray '\' in program
cataoukta:25: error: stray '\' in program
cataoukta:26: error: stray '\' in program
cataoukta:9: error: expected constructor, destructor, or type conversion before 'void'
cataoukta:6: error: expected initializer before 'u037e'
cataoukta.ino: In function 'void loop()':
cataoukta:20: error: 'estado' was not declared in this scope
cataoukta:20: error: 'button' was not declared in this scope
cataoukta:20: error: expected `;' before 'u037e'
6
  • Can you please post the exact error message. Commented Nov 24, 2016 at 11:33
  • I edit the post with the error ;) Commented Nov 24, 2016 at 11:35
  • The problem appears to be in your library. What version of Arduino IDE are you using? Are you using the built in Servo library? Commented Nov 24, 2016 at 11:45
  • Is this your full code? Commented Nov 24, 2016 at 11:46
  • My guess is you have some strange unicode character(s) in there. A common problem when not programming in English. Commented Nov 24, 2016 at 12:02

1 Answer 1

6

You have bad Unicode characters in your code. All your semicolons are something completely different and need replacing with real semicolons.

enter image description here

1
  • 1
    $ charinfo '13;' U+0031 DIGIT ONE [Nd] U+0033 DIGIT THREE [Nd] U+037E GREEK QUESTION MARK [Po] Commented Nov 24, 2016 at 12:57

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.