2014-06-22 6 views
0

Nous avons obtenu cette erreur dans le code suivant. Je suis un débutant dans ce domaine, alors expliquez-nous d'une manière simple ce que nous avons pu faire de mal.erreur: constructeur attendu, destructeur, ou conversion de type avant 'typedef' dans arduino uno

#include <Servo.h> 

Servo myservo1; // create servo object to control a servo 
Servo myservo2; 
Servo myservo3; 
Servo myservo4; 
Servo myservo5; 

int potpin1 = 0; // analog pin used to connect the potentiometer 
int val1; // variable to read the value from the analog pin 

int potpin2 = 1; 
int val2; 

int potpin3 = 2; 
int val3; 

int potpin4 = 3; 
int val4; 

int potpin5 = 4; 
int val5; 

void setup() 
{ 
    myservo1.attach(3); // attaches the servo on pin 9 to the servo object 
    myservo2.attach(5); 
    myservo3.attach(6); 
    myservo4.attach(9); 
    myservo5.attach(10); 
} 

void loop() 
{ 
    val1 = analogRead(potpin1);   // reads the value of the potentiometer (value between 0 and 1023) 
    val1 = map(val1, 0, 1023, 0, 179);  // scale it to use it with the servo (value between 0 and 180) 
    myservo1.write(val1);     // sets the servo position according to the scaled value 

    delay(15);       // waits for the servo to get there 

    val2 = analogRead(potpin2); 
    val2 = map(val2, 0, 1023, 0, 179); 
    myservo2.write(val2); 

    delay(15);   

    val3 = analogRead(potpin3); 
    val3 = map(val3, 0, 1023, 0, 179); 
    myservo3.write(val3); 

    delay(15);   

    val4 = analogRead(potpin4); 
    val4 = map(val4, 0, 1023, 0, 179); 
    myservo4.write(val4); 

    delay(15);   

    val5 = analogRead(potpin5); 
    val5 = map(val5, 0, 1023, 0, 179); 
    myservo5.write(val5); 

    delay(15);   
} 

Répondre

1

Ce code se compile parfaitement dans le dernier IDE Arduino (sur OSX). Vous n'indiquez pas sur quelle plate-forme vous êtes ou quels moyens vous utilisez pour compiler votre code. Il semble que vous ayez une mauvaise installation de l'IDE Arduino et des bibliothèques ou que vous utilisiez autre chose qui n'est pas correctement configuré.

+0

Il compile également sous Arduino 1.0.5-r2 sous Windows 8.1. –

+0

Il compile également sous Arduino 1.0.5 sous Windows XP. – cup

Questions connexes