Cos'è ElectroYou | Login Iscriviti

ElectroYou - la comunità dei professionisti del mondo elettrico

Errore expected inilitializer before'?' token

Progetti, interfacciamento, discussioni varie su questa piattaforma.

Moderatori: Foto UtenteWALTERmwp, Foto Utentexyz

0
voti

[1] Errore expected inilitializer before'?' token

Messaggioda Foto Utentepapa10 » 19 ott 2017, 20:06

Gradirei un aiuto riguardante il codice sotto riportato,che nelle compilazione mi da' l'errore sopracitato:
Codice: Seleziona tutto
#include <Servo.h>
Servo servobase;
Servo servoshoulder;
Servo servoforearm;
void setup() {
servobase.attach(9); // Set servo to digital pin 9, min, max
servoshoulder.attach(10); // Set servo to digital pin 10, min, max
servoforearm.attach(11); // Set servo to digital pin 11, min, max
}
void loop() { // Loop through motion tests
middle(); //go to start pos
delay(2500); // Wait 1000 milliseconds (1 seconds)
left();
delay(2500);
right();
delay(2500);
}
void middle() {
servobase.writeMicroseconds(1500); //1500 is the midpoint
servoshoulder.writeMicroseconds(1500);
servoforearm.writeMicroseconds(1500);
}
void left() {
servobase.writeMicroseconds(1500); //1000 is all the way left
servoshoulder.writeMicroseconds(1500);
servoforearm.writeMicroseconds(1500);
}
void right() {
servobase.writeMicroseconds(1500); //2000 is all the way right
servoshoulder.writeMicroseconds(1500);
servoforearm.writeMicroseconds(1500);
}
Vi ringrazio
Avatar utente
Foto Utentepapa10
71 1 3 4
Frequentatore
Frequentatore
 
Messaggi: 248
Iscritto il: 20 ott 2011, 17:11

0
voti

[2] Re: Errore expected inilitializer before'?' token

Messaggioda Foto Utentexyz » 19 ott 2017, 21:57

Quando si riporta un errore deve essere completo, manca una informazione: il numero di riga.

Comunque dal codice riportato pare corretto e non genera nessun errore.
Avatar utente
Foto Utentexyz
6.864 2 4 6
G.Master EY
G.Master EY
 
Messaggi: 1778
Iscritto il: 5 dic 2009, 18:37
Località: Italy Turin

0
voti

[3] Re: Errore expected inilitializer before'?' token

Messaggioda Foto Utentepapa10 » 20 ott 2017, 7:52

Grazie ok risolto!!
Avatar utente
Foto Utentepapa10
71 1 3 4
Frequentatore
Frequentatore
 
Messaggi: 248
Iscritto il: 20 ott 2011, 17:11


Torna a Arduino

Chi c’è in linea

Visitano il forum: Nessuno e 2 ospiti