Bonjour à tous,
Je suis actuellement en classe de terminale S-SI et j'ai durant cette année un projet à réaliser. Mon projet consiste à robotiser un casque de moto afin que la visière monte ou descende par commande vocale. J'ai pour cela deux micro moteur ainsi que trois plaques Arduino que sont la Uno, le Power & Motor shield (référence WA03) et une EasyVR pour la commande vocale.
Après plusieurs heures et semaines de travail j'arrive enfin à un programme potentiellement fonctionnel. Le souci est donc que je ne peux savoir si mon programme est fonctionnel car lorsque je veux le téléverser, j'obtient cette erreur :
"avrdude: stk500_getsync(): not in sync: resp=0x00"
Je sais qu'il s'agit d'un problème de transmission mais je ne sais comment le régler. Je précise aussi que lorsque je téléverse mon programme mes trois cartes sont empilées et connectées.
C'est pourquoi je requiers de l'aide de votre part.
Voici le code s'il y en a besoin :
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#include "SoftwareSerial.h"
SoftwareSerial port(12,13);
#else // Arduino 0022 - use modified NewSoftSerial
#include "WProgram.h"
#include "NewSoftSerial.h"
NewSoftSerial port(12,13);
#endif
#include "EasyVR.h"
EasyVR easyvr(port);
int pwm_a = 3; //PWM control for motor outputs 1 and 2
//int pwm_b = 9; //PWM control for motor outputs 3 and 4
int dir_a = 2; //direction control for motor outputs 1 and 2
//int dir_b = 8; //direction control for motor outputs 3 and 4
//Groups and Commands
enum Wordset
{
DIRECTION_SET = 2,
};
enum DIRECTION_SET
{
UP = 2,
DOWN = 3,
};
EasyVRBridge bridge;
int8_t group, idx;
void setup()
{
// bridge mode?
if (bridge.check())
{
cli();
bridge.loop(0, 1, 12, 13);
}
// run normally
Serial.begin(9600);
port.begin(9600);
if (!easyvr.detect())
{
Serial.println("EasyVR non detecte!");
for (;;);
}
easyvr.setPinOutput(EasyVR::IO1, LOW);
Serial.println("EasyVR detecte!");
easyvr.setTimeout(5);
easyvr.setLanguage(0);
group = EasyVR::TRIGGER; //<-- start group (customize)
pinMode(pwm_a, OUTPUT); //Set control pins to be outputs
// pinMode(pwm_b, OUTPUT);
pinMode(dir_a, OUTPUT);
//pinMode(dir_b, OUTPUT);
analogWrite(pwm_a, 255); //set both motors to run at (255/255 = 100)% duty cycle (quick)
//analogWrite(pwm_b, 255);
}
void action();
void loop()
{
easyvr.setPinOutput(EasyVR::IO1, HIGH); // LED on (listening)
Serial.print("Prononcez un mot du groupe ");
Serial.println(group);
easyvr.recognizeCommand(group);
do
{
// can do some processing while waiting for a spoken command
}
while (!easyvr.hasFinished());
easyvr.setPinOutput(EasyVR::IO1, LOW); // LED off
group = DIRECTION_SET;
idx = easyvr.getCommand();
if (idx >= 0)
{
// built-in trigger (ROBOT)
// group = GROUP_X; <-- jump to another group X
return;
}
idx = easyvr.getCommand();
if (idx >= 0)
{
// print debug message
uint8_t train = 0;
char name[32];
Serial.print("Commande: ");
Serial.print(idx);
if (easyvr.dumpCommand(group, idx, name, train))
{
Serial.print(" = ");
Serial.println(name);
}
else
Serial.println();
easyvr.playSound(0, EasyVR::VOL_FULL);
// perform some action
action();
}
else // errors or timeout
{
if (easyvr.isTimeout())
Serial.println("Temps d'attente depasse, recommencez...");
int16_t err = easyvr.getError();
if (err >= 0)
{
Serial.print("Erreur ");
Serial.println(err, HEX);
}
}
}
void action()
{
switch (group)
{
case DIRECTION_SET:
switch (idx)
{
case UP:
digitalWrite(dir_a, LOW);
//delay(1000);
analogWrite(pwm_a, 255);
delay(1000);
break;
case DOWN:
digitalWrite (dir_a, HIGH);
//delay(1000);
analogWrite(pwm_a, 255);
delay(1000);
break;
}
}
}