Aller au contenu


Photo
- - - - -

problémé code arduino librairie


  • Veuillez vous connecter pour répondre
5 réponses à ce sujet

#1 stephane83

stephane83

    Membre

  • Membres
  • 64 messages

Posté 20 août 2013 - 06:41

salut à tous,

voila je viens de créer un robot hexapode, et je souhaite-le contrôler par un wii nunchuck car: il est pas chère ,et on a un accéléromètre a 3 axes, deux boutons et un joystick pour 15 euro!!

j'ai acheté cette adaptateur :http://www.robotshop.com/productinfo.aspx?pc=RB-Dfr-62&lang=fr-CA pour un carte arduino Uno.

pour m'aider dans programmation j'ai télécharger sur ce page http://www.pobot.org/-Capteurs-Wii-.html , une librairie pour le nunchuck et un exemple de programme pour servo ( piéce jointe les fichier).

et là ça bug : je transfère tout dans arduino et je vérifie, j’obtiens un message d'erreur :

In file included from ChuckServoTest.cpp:3:
/WiiChuck.h:33:23: error: WProgram.h: No such file or directory
In file included from ChuckServoTest.cpp:3:
WiiChuck.h:47: error: 'byte' does not name a type
WiiChuck.h:49: error: 'byte' does not name a type
WiiChuck.h:59: error: 'boolean' does not name a type
WiiChuck.h:63: error: 'byte' does not name a type
WiiChuck.h:64: error: 'byte' does not name a type
WiiChuck.h:65: error: 'boolean' does not name a type
WiiChuck.h:66: error: 'boolean' does not name a type
WiiChuck.h:144: error: 'boolean' does not name a type
WiiChuck.h:147: error: 'boolean' does not name a type
WiiChuck.h:152: error: 'boolean' does not name a type
WiiChuck.h:157: error: 'boolean' does not name a type
WiiChuck.h:188: error: 'byte' does not name a type
/WiiChuck.h: In member function 'void WiiChuck::begin()':
WiiChuck.h:71: error: 'cnt' was not declared in this scope
WiiChuck.h:72: error: 'averageCounter' was not declared in this scope
WiiChuck.h:74: error: 'class TwoWire' has no member named 'send'

As of Arduino 1.0, the Wire.send() function was renamed to Wire.write() for consistency with other libraries.

WiiChuck.h:75: error: 'class TwoWire' has no member named 'send'

As of Arduino 1.0, the Wire.send() function was renamed to Wire.write() for consistency with other libraries.

/WiiChuck.h: In member function 'void WiiChuck::calibrateJoy()':
WiiChuck.h:87: error: 'joyX' was not declared in this scope
WiiChuck.h:88: error: 'joyY' was not declared in this scope
/WiiChuck.h: In member function 'void WiiChuck::update()':
WiiChuck.h:96: error: 'cnt' was not declared in this scope
WiiChuck.h:96: error: 'class TwoWire' has no member named 'receive'

As of Arduino 1.0, the Wire.receive() function was renamed to Wire.read() for consistency with other libraries.

WiiChuck.h:96: error: '_nunchuk_decode_byte' was not declared in this scope
WiiChuck.h:99: error: 'cnt' was not declared in this scope
WiiChuck.h:100: error: 'lastZ' was not declared in this scope
WiiChuck.h:100: error: 'buttonZ' was not declared in this scope
WiiChuck.h:101: error: 'lastC' was not declared in this scope
WiiChuck.h:101: error: 'buttonC' was not declared in this scope
WiiChuck.h:109: error: 'joyX' was not declared in this scope
WiiChuck.h:110: error: 'joyY' was not declared in this scope
WiiChuck.h:113: error: 'B00000011' was not declared in this scope
WiiChuck.h:118: error: 'B00000001' was not declared in this scope
WiiChuck.h:119: error: 'B00000010' was not declared in this scope
/WiiChuck.h: In member function 'int WiiChuck::readJoyX()':
WiiChuck.h:163: error: 'joyX' was not declared in this scope
/WiiChuck.h: In member function 'int WiiChuck::readJoyY()':
WiiChuck.h:167: error: 'joyY' was not declared in this scope
/WiiChuck.h: In member function 'void WiiChuck::_send_zero()':
WiiChuck.h:197: error: 'class TwoWire' has no member named 'send'

As of Arduino 1.0, the Wire.send() function was renamed to Wire.write() for consistency with other libraries.

ChuckServoTest.cpp: In function 'void setup()':
ChuckServoTest.pde:-1: error: 'PC3' was not declared in this scope
ChuckServoTest.pde:-1: error: 'PC2' was not declared in this scope

Donc je me dis qu'il faudrait que je test un autre fichier,


du coup je vais sur ce cette page qui est super : http://blog.oscarliang.net/wii-nunchuck-arduino-tutorial/

et la aussi une erreur que même la personne qui a créé ce tuto ne comprend pas :

In file included from nunchuk_h.cpp:1:
/nunchuck.h:8:22: error: WProgram.h: No such file or directory
/nunchuck.h:10:25: error: utility\twi.h: No such file or directory
In file included from nunchuk_h.cpp:1:
nunchuck.h:13: error: 'byte' was not declared in this scope
nunchuck.h:13: error: expected `)' before numeric constant
nunchuck.h:13: error: expected `]' before ';' token
nunchuck.h:17: error: 'byte' does not name a type
nunchuck.h:18: error: 'byte' does not name a type
nunchuck.h:19: error: 'byte' does not name a type
nunchuck.h:20: error: 'byte' does not name a type
nunchuck.h:21: error: 'byte' does not name a type
nunchuck.h:22: error: 'boolean' does not name a type
nunchuck.h:23: error: 'boolean' does not name a type
nunchuck.h:26: error: 'byte' does not name a type
nunchuck.h:27: error: 'byte' does not name a type
nunchuck.h:28: error: 'byte' does not name a type
nunchuck.h:29: error: 'byte' does not name a type
nunchuck.h:30: error: 'byte' does not name a type
nunchuck.h:32: error: 'byte' does not name a type
nunchuck.h:38: error: 'byte' does not name a type
/nunchuck.h: In function 'void clearTwiInputBuffer()':
nunchuck.h:64: error: 'Wire' was not declared in this scope
/nunchuck.h: In function 'void ConvertOutputs()':
nunchuck.h:93: error: 'byte' was not declared in this scope
nunchuck.h:93: error: expected `;' before 'temp_JX'
nunchuck.h:94: error: expected `;' before 'temp_JY'
nunchuck.h:95: error: expected `;' before 'temp_AX'
nunchuck.h:96: error: expected `;' before 'temp_AY'
nunchuck.h:97: error: expected `;' before 'temp_AZ'
nunchuck.h:99: error: 'temp_JX' was not declared in this scope
nunchuck.h:99: error: 'outbuf' was not declared in this scope
nunchuck.h:100: error: 'temp_JY' was not declared in this scope
nunchuck.h:101: error: 'temp_AX' was not declared in this scope
nunchuck.h:101: error: 'map' was not declared in this scope
nunchuck.h:102: error: 'temp_AY' was not declared in this scope
nunchuck.h:103: error: 'temp_AZ' was not declared in this scope
nunchuck.h:105: error: 'NunC_BZ' was not declared in this scope
nunchuck.h:106: error: 'NunC_BZ' was not declared in this scope
nunchuck.h:107: error: 'NunC_BC' was not declared in this scope
nunchuck.h:108: error: 'NunC_BC' was not declared in this scope
nunchuck.h:119: error: 'NunC_JX_buf' was not declared in this scope
nunchuck.h:119: error: 'bIndex' was not declared in this scope
nunchuck.h:120: error: 'NunC_JY_buf' was not declared in this scope
nunchuck.h:121: error: 'NunC_AX_buf' was not declared in this scope
nunchuck.h:122: error: 'NunC_AY_buf' was not declared in this scope
nunchuck.h:123: error: 'NunC_AZ_buf' was not declared in this scope
nunchuck.h:135: error: 'NunC_JX' was not declared in this scope
nunchuck.h:142: error: 'NunC_JY' was not declared in this scope
nunchuck.h:149: error: 'NunC_AX' was not declared in this scope
nunchuck.h:156: error: 'NunC_AY' was not declared in this scope
nunchuck.h:163: error: 'NunC_AZ' was not declared in this scope
/nunchuck.h: In function 'void NunC_Init(short unsigned int)':
nunchuck.h:180: error: 'PORTC' was not declared in this scope
nunchuck.h:180: error: 'PORTC2' was not declared in this scope
nunchuck.h:180: error: '_BV' was not declared in this scope
nunchuck.h:181: error: 'PORTC3' was not declared in this scope
nunchuck.h:182: error: 'DDRC' was not declared in this scope
nunchuck.h:183: error: 'delay' was not declared in this scope
nunchuck.h:187: error: 'Wire' was not declared in this scope
nunchuck.h:192: error: 'TWBR' was not declared in this scope
nunchuck.h:192: error: 'CPU_FREQ' was not declared in this scope
nunchuck.h:194: error: 'byte' was not declared in this scope
nunchuck.h:194: error: expected `;' before 'rc'
nunchuck.h:207: error: 'millis' was not declared in this scope
nunchuck.h:210: error: expected `)' before numeric constant
nunchuck.h:210: error: expected `)' before ';' token
nunchuck.h:215: error: expected `)' before numeric constant
nunchuck.h:215: error: expected `)' before ';' token
nunchuck.h:220: error: 'rc' was not declared in this scope
nunchuck.h:224: error: 'rc' was not declared in this scope
nunchuck.h:229: error: expected `;' before 'i'
nunchuck.h:230: error: 'outbuf' was not declared in this scope
nunchuck.h:230: error: 'readControllerIdent' was not declared in this scope
nunchuck.h:232: error: 'Serial' was not declared in this scope
nunchuck.h:233: error: 'i' was not declared in this scope
nunchuck.h:233: error: expected `)' before numeric constant
nunchuck.h:235: error: 'HEX' was not declared in this scope
nunchuck.h:241: error: 'Serial' was not declared in this scope
/nunchuck.h: At global scope:
nunchuck.h:245: error: 'boolean' does not name a type
/nunchuck.h: In function 'void NunC_SendNextByteRequest()':
nunchuck.h:266: error: 'byte' was not declared in this scope
nunchuck.h:266: error: expected `;' before 'i'
nunchuck.h:266: error: 'i' was not declared in this scope
nunchuck.h:268: error: 'Wire' was not declared in this scope
nunchuck.h:268: error: expected `)' before numeric constant
nunchuck.h:268: error: expected `)' before ';' token
/nunchuck.h: In function 'void print()':
nunchuck.h:277: error: 'Serial' was not declared in this scope
nunchuck.h:277: error: 'NunC_JX' was not declared in this scope
nunchuck.h:277: error: 'DEC' was not declared in this scope
nunchuck.h:280: error: 'NunC_JY' was not declared in this scope
nunchuck.h:283: error: 'NunC_AX' was not declared in this scope
nunchuck.h:286: error: 'NunC_AY' was not declared in this scope
nunchuck.h:289: error: 'NunC_AZ' was not declared in this scope
nunchuck.h:292: error: 'NunC_BZ' was not declared in this scope
nunchuck.h:295: error: 'NunC_BC' was not declared in this scope
nunchuk_h.cpp: In function 'void loop()':
nunchuk_h:11: error: 'NunC_RecieveCommand' was not declared in this scope
nunchuk_h:13: error: 'NunC_JX' was not declared in this scope
nunchuk_h:16: error: 'NunC_JY' was not declared in this scope
nunchuk_h:19: error: 'NunC_AX' was not declared in this scope
nunchuk_h:22: error: 'NunC_AY' was not declared in this scope
nunchuk_h:25: error: 'NunC_AZ' was not declared in this scope
nunchuk_h:28: error: 'NunC_BC' was not declared in this scope
nunchuk_h:31: error: 'NunC_BZ' was not declared in this scope



si Quelqu'un peut m'aider à trouver une solution, merci d'avance !!
et a bientôt!

Fichier(s) joint(s)


merci pour le forum, stephane83

#2 olivthill

olivthill

    Membre occasionnel

  • Membres
  • Pip
  • 143 messages
  • Gender:Male
  • Location:Normandie

Posté 20 août 2013 - 10:42

Le premier message d'erreur est important :

"In file included from ChuckServoTest.cpp:3: /WiiChuck.h:33:23: error: WProgram.h: No such file or directory"

Le fichier WProgram.h est manquant.
Ce n'est pas un programme standard. Je ne l'ai pas dans mon environnement Arduino. Je ne ne vois pas sur la page http://www.pobot.org/Controle-avec-un-Wii-Nunchuck.html . Je ne sais pas d'où il vient et ce qu'il doit contenir. En tous cas, il faut soit ajouter ce fichier au bon endroit, soit supprimer la ligne d'include de ce fichier.

Ensuite, les messages d'erreur concernant "byte" sont un peu étonnant, car ce type de donnée devrait exister. Ces messages sont peut-être causés par le problème précédent.

#3 stephane83

stephane83

    Membre

  • Membres
  • 64 messages

Posté 23 août 2013 - 05:45

Le premier message d'erreur est important :

"In file included from ChuckServoTest.cpp:3: /WiiChuck.h:33:23: error: WProgram.h: No such file or directory"

Le fichier WProgram.h est manquant.
Ce n'est pas un programme standard. Je ne l'ai pas dans mon environnement Arduino. Je ne ne vois pas sur la page http://www.pobot.org/Controle-avec-un-Wii-Nunchuck.html . Je ne sais pas d'où il vient et ce qu'il doit contenir. En tous cas, il faut soit ajouter ce fichier au bon endroit, soit supprimer la ligne d'include de ce fichier.

Ensuite, les messages d'erreur concernant "byte" sont un peu étonnant, car ce type de donnée devrait exister. Ces messages sont peut-être causés par le problème précédent.


salut Olivthill et merci pour avoir répondue! j'ai bien compris ton explication , pour la deuxième librairie tu sais d’où elle peut venir ?

Merci encore à bientôt!
merci pour le forum, stephane83

#4 olivthill

olivthill

    Membre occasionnel

  • Membres
  • Pip
  • 143 messages
  • Gender:Male
  • Location:Normandie

Posté 23 août 2013 - 10:19

j'ai bien compris ton explication


Ok. Content de l'apprendre. Mais est-ce qu'une action correctrice a été entreprise pour résoudre le problème ?

Si oui quel est le résultat maintenant ?

Si non, alors j'ai trouvé la solution entre-temps.
Il faudrait remplacer la ligne :

#include "WProgram.h"

par

#include "Arduino.h"

C'est parce que ça a changé depuis l'époque des anciennes Arduinos.

pour la deuxième librairie tu sais d’où elle peut venir ?

Quelle deuxième librairie ?

#5 stephane83

stephane83

    Membre

  • Membres
  • 64 messages

Posté 24 août 2013 - 09:53

Ok. Content de l'apprendre. Mais est-ce qu'une action correctrice a été entreprise pour résoudre le problème ?

Si oui quel est le résultat maintenant ?

Si non, alors j'ai trouvé la solution entre-temps.
Il faudrait remplacer la ligne :

#include "WProgram.h"

par

#include "Arduino.h"

C'est parce que ça a changé depuis l'époque des anciennes Arduinos.


Quelle deuxième librairie ?


Salut, ouais en farfouillant, j'ai trouvé la même solution que toi "Arduino.H" car ce que tu mais expliquez-m'a fait comprendre qu'il y avait un problème de version d'arduino, j'ai testé la 0028 qui m'a mis sur la piste ^^! pour la deuxième c'est sur ce blog http://blog.oscarliang.net/wii-nunchuck-arduino-tutorial/ .
Merci pour ton aide j'ai appris des choses à prendre en compte sur arduino ! Là je vais déjà essayer de mettre un programme simple avec servo.h pour faire avancer mon robot tout droit .
merci pour le forum, stephane83

#6 olivthill

olivthill

    Membre occasionnel

  • Membres
  • Pip
  • 143 messages
  • Gender:Male
  • Location:Normandie

Posté 24 août 2013 - 11:29

Pour l'autre programme, ce sont les deux messages suivants qui sont importants

/nunchuck.h:8:22: error: WProgram.h: No such file or directory
/nunchuck.h:10:25: error: utility\twi.h: No such file or directory

Comme pour l'autre, il faut remplacer

#include "WProgram.h"

par

#include "Arduino.h"


Ensuite, la ligne suivante causse l'autre erreur :

#include <utility\twi.h>

Le fichier twi.h est présent en standard. Il est même dans plusieurs répertoires.
Je pense qu'il faut avoir celui qui se trouve dans toto\arduino-1.0.3\libraries\Wire\utility
Il faut que ce fichier soit au bon endroit par rapport au programme.
Peut-être il faudra modifier le chemin dans la ligne include, ou alors il faudra créer un sous-répertoire "utility" et y copier twi.h




0 utilisateur(s) li(sen)t ce sujet

0 members, 0 guests, 0 anonymous users