Hello all, I am working on a project for an engineering course. It is a robotic hand that can be voice controlled to perform different gestures and signs. I'm still adding to it but I recently purchased the DF Robot Voice Controller and I am trying to integrate it into my code. I have no error messages but when I run the code, there is no physical output. I believe I ordered something wrong but don't know what. If anyone has any insight into what could be going wrong or what I omitted it would be very much appreciated so that I can get unstuck.
#include <Servo.h>
#include "DFRobot_DF2301Q.h"
DFRobot_DF2301Q_I2C DF2301Q;
int i = 0;
int pause = 1000;
Servo botpinky;
Servo toppinky;
Servo botring;
Servo topring;
Servo botbird;
Servo topbird;
Servo botpoint;
Servo toppoint;
Servo wristang;
Servo wristrot;
Servo botthumb;
Servo topthumb;
void setup() {
Serial.begin(115200);
botpinky.attach(11);
toppinky.attach(2);
botring.attach(3);
topring.attach(4);
botbird.attach(5);
topbird.attach(6);
botpoint.attach(7);
toppoint.attach(8);
wristang.attach(9);
wristrot.attach(10);
botthumb.attach(12);
topthumb.attach(13);
}
void stop() {
while(1) { /* spin and do nothing */ };
}
void Alphabet(){
if (i < 26) {
A();
B();
C();
D();
E();
Eff();
G();
H();
I();
J();
K();
L();
M();
N();
O();
P();
Q();
R();
S();
T();
U();
V();
W();
X();
Y();
Z();
}
else if(i=26){
Serial.print("Now I Know My ABCs");
stop();
}
}
void Reset() {
botpinky.write(90);
toppinky.write(90);
botring.write(90);
topring.write(90);
botbird.write(90);
topbird.write(90);
botpoint.write(90);
toppoint.write(90);
botthumb.write(90);
topthumb.write(90);
wristrot.write(90);
wristang.write(90);
delay(pause);
++i;
Serial.print(i);
}
void A() {
botpinky.write(0);
toppinky.write(90);
botring.write(0);
topring.write(90);
botbird.write(0);
topbird.write(90);
botpoint.write(0);
toppoint.write(90);
botthumb.write(90);
topthumb.write(90);
wristrot.write(90);
wristang.write(90);
delay(pause);
Reset();
}
void B() {
botpinky.write(90);
toppinky.write(90);
botring.write(90);
topring.write(90);
botbird.write(90);
topbird.write(90);
botpoint.write(90);
toppoint.write(90);
botthumb.write(45);
topthumb.write(90);
wristrot.write(90);
wristang.write(90);
delay(pause);
Reset();
}
void C() {
botpinky.write(45);
toppinky.write(45);
botring.write(45);
topring.write(45);
botbird.write(45);
topbird.write(45);
botpoint.write(45);
toppoint.write(45);
wristang.write(65);
botthumb.write(90);
topthumb.write(90);
wristrot.write(0);
wristang.write(60);
delay(pause);
Reset();
}
void D() {
botpinky.write(45);
toppinky.write(45);
botring.write(45);
topring.write(45);
botbird.write(45);
topbird.write(45);
botpoint.write(0);
toppoint.write(0);
botthumb.write(30);
topthumb.write(45);
wristrot.write(0);
wristang.write(60);
delay(pause);
Reset();
}
void E() {
botpinky.write(45);
toppinky.write(70);
botring.write(45);
topring.write(70);
botbird.write(45);
topbird.write(70);
botpoint.write(45);
toppoint.write(70);
botthumb.write(30);
topthumb.write(45);
wristrot.write(90);
wristang.write(90);
delay(pause);
Reset();
}
void Eff() {
botpinky.write(90);
toppinky.write(90);
botring.write(90);
topring.write(90);
botbird.write(90);
topbird.write(90);
botpoint.write(60);
toppoint.write(45 );
botthumb.write(90);
topthumb.write(90);
wristrot.write(90);
wristang.write(90);
delay(pause);
Reset();
}
void G() {
botpinky.write(0);
toppinky.write(0);
botring.write(0);
topring.write(0);
botbird.write(0);
topbird.write(0);
botpoint.write(90);
toppoint.write(90);
botthumb.write(45);
topthumb.write(60);
wristrot.write(0);
wristang.write(45);
delay(pause);
Reset();
}
void H() {
botpinky.write(0);
toppinky.write(0);
botring.write(0);
topring.write(0);
botbird.write(70);
topbird.write(90);
botpoint.write(70);
toppoint.write(90);
botthumb.write(0);
topthumb.write(0);
wristrot.write(0);
wristang.write(45);
delay(pause);
Reset();
}
void I() {
botpinky.write(90);
toppinky.write(90);
botring.write(0);
topring.write(90);
botbird.write(0);
topbird.write(90);
botpoint.write(0);
toppoint.write(90);
botthumb.write(90);
topthumb.write(90);
wristrot.write(90);
wristang.write(90);
delay(pause);
Reset();
}
void J() {
botpinky.write(90);
toppinky.write(90);
botring.write(0);
topring.write(90);
botbird.write(0);
topbird.write(90);
botpoint.write(0);
toppoint.write(90);
botthumb.write(90);
topthumb.write(90);
wristrot.write(70);
wristang.write(45);
delay(pause);
Reset();
}
void K() {
botpinky.write(0);
toppinky.write(0);
botring.write(60);
topring.write(45);
botbird.write(60);
topbird.write(45);
botpoint.write(60);
toppoint.write(45);
botthumb.write(90);
topthumb.write(90);
wristrot.write(90);
wristang.write(90);
delay(pause);
Reset();
}
void L() {
botpinky.write(0);
toppinky.write(0);
botring.write(60);
topring.write(45);
botbird.write(60);
topbird.write(45);
botpoint.write(60);
toppoint.write(45);
botthumb.write(90);
topthumb.write(90);
wristrot.write(90);
wristang.write(90);
delay(pause);
Reset();
}
void M() {
botpinky.write(0);
toppinky.write(0);
botring.write(60);
topring.write(45);
botbird.write(60);
topbird.write(45);
botpoint.write(60);
toppoint.write(45);
botthumb.write(90);
topthumb.write(90);
wristrot.write(90);
wristang.write(90);
delay(pause);
Reset();
}
void N() {
botpinky.write(0);
toppinky.write(0);
botring.write(60);
topring.write(45);
botbird.write(60);
topbird.write(45);
botpoint.write(60);
toppoint.write(45);
botthumb.write(90);
topthumb.write(90);
wristrot.write(90);
wristang.write(90);
delay(pause);
Reset();
}
void O() {
botpinky.write(0);
toppinky.write(0);
botring.write(60);
topring.write(45);
botbird.write(60);
topbird.write(45);
botpoint.write(60);
toppoint.write(45);
botthumb.write(90);
topthumb.write(90);
wristrot.write(90);
wristang.write(90);
delay(pause);
Reset();
}
void P() {
botpinky.write(0);
toppinky.write(0);
botring.write(60);
topring.write(45);
botbird.write(60);
topbird.write(45);
botpoint.write(60);
toppoint.write(45);
botthumb.write(90);
topthumb.write(90);
wristrot.write(90);
wristang.write(90);
delay(pause);
Reset();
}
void Q() {
botpinky.write(0);
toppinky.write(0);
botring.write(60);
topring.write(45);
botbird.write(60);
topbird.write(45);
botpoint.write(60);
toppoint.write(45);
botthumb.write(90);
topthumb.write(90);
wristrot.write(90);
wristang.write(90);
delay(pause);
Reset();
}
void R() {
botpinky.write(0);
toppinky.write(0);
botring.write(60);
topring.write(45);
botbird.write(60);
topbird.write(45);
botpoint.write(60);
toppoint.write(45);
botthumb.write(90);
topthumb.write(90);
wristrot.write(90);
wristang.write(90);
delay(pause);
Reset();
}
void S() {
botpinky.write(0);
toppinky.write(0);
botring.write(60);
topring.write(45);
botbird.write(60);
topbird.write(45);
botpoint.write(60);
toppoint.write(45);
botthumb.write(90);
topthumb.write(90);
wristrot.write(90);
wristang.write(90);
delay(pause);
Reset();
}
void T() {
botpinky.write(0);
toppinky.write(0);
botring.write(60);
topring.write(45);
botbird.write(60);
topbird.write(45);
botpoint.write(60);
toppoint.write(45);
botthumb.write(90);
topthumb.write(90);
wristrot.write(90);
wristang.write(90);
delay(pause);
Reset();
}
void U() {
botpinky.write(0);
toppinky.write(0);
botring.write(60);
topring.write(45);
botbird.write(60);
topbird.write(45);
botpoint.write(60);
toppoint.write(45);
botthumb.write(90);
topthumb.write(90);
wristrot.write(90);
wristang.write(90);
delay(pause);
Reset();
}
void V() {
botpinky.write(0);
toppinky.write(0);
botring.write(60);
topring.write(45);
botbird.write(60);
topbird.write(45);
botpoint.write(60);
toppoint.write(45);
botthumb.write(90);
topthumb.write(90);
wristrot.write(90);
wristang.write(90);
delay(pause);
Reset();
}
void W() {
botpinky.write(0);
toppinky.write(0);
botring.write(60);
topring.write(45);
botbird.write(60);
topbird.write(45);
botpoint.write(60);
toppoint.write(45);
botthumb.write(90);
topthumb.write(90);
wristrot.write(90);
wristang.write(90);
delay(pause);
Reset();
}
void X() {
botpinky.write(0);
toppinky.write(0);
botring.write(60);
topring.write(45);
botbird.write(60);
topbird.write(45);
botpoint.write(60);
toppoint.write(45);
botthumb.write(90);
topthumb.write(90);
wristrot.write(90);
wristang.write(90);
delay(pause);
Reset();
}
void Y() {
botpinky.write(0);
toppinky.write(0);
botring.write(60);
topring.write(45);
botbird.write(60);
topbird.write(45);
botpoint.write(60);
toppoint.write(45);
botthumb.write(90);
topthumb.write(90);
wristrot.write(90);
wristang.write(90);
delay(pause);
Reset();
}
void Z() {
botpinky.write(0);
toppinky.write(0);
botring.write(60);
topring.write(45);
botbird.write(60);
topbird.write(45);
botpoint.write(60);
toppoint.write(45);
botthumb.write(90);
topthumb.write(90);
wristrot.write(90);
wristang.write(90);
delay(pause);
Reset();
}
void LordVader() {
botpinky.write(45);
toppinky.write(45);
botring.write(45);
topring.write(45);
botbird.write(45);
topbird.write(45);
botpoint.write(45);
toppoint.write(45);
botthumb.write(70);
topthumb.write(30);
wristrot.write(90);
wristang.write(15);
delay(pause);
}
void GetThreeCoffinsReady() {
botpinky.write(0);
toppinky.write(0);
botring.write(60);
topring.write(45);
botbird.write(60);
topbird.write(45);
botpoint.write(60);
toppoint.write(45);
botthumb.write(90);
topthumb.write(90);
wristrot.write(90);
wristang.write(90);
delay(pause);
}
void Nixon() {
botpinky.write(0);
toppinky.write(0);
botring.write(60);
topring.write(45);
botbird.write(60);
topbird.write(45);
botpoint.write(60);
toppoint.write(45);
botthumb.write(90);
topthumb.write(90);
wristrot.write(90);
wristang.write(90);
delay(pause);
}
void LLAP(){
botpinky.write(0);
toppinky.write(0);
botring.write(60);
topring.write(45);
botbird.write(60);
topbird.write(45);
botpoint.write(60);
toppoint.write(45);
botthumb.write(90);
topthumb.write(90);
wristrot.write(90);
wristang.write(90);
delay(pause);
}
void Trump(){
botpinky.write(0);
toppinky.write(0);
botring.write(60);
topring.write(45);
botbird.write(60);
topbird.write(45);
botpoint.write(60);
toppoint.write(45);
botthumb.write(90);
topthumb.write(90);
wristrot.write(90);
wristang.write(90);
delay(pause);
}
void MafuhCutMeOff(){
botpinky.write(0);
toppinky.write(0);
botring.write(60);
topring.write(45);
botbird.write(60);
topbird.write(45);
botpoint.write(60);
toppoint.write(45);
botthumb.write(90);
topthumb.write(90);
wristrot.write(90);
wristang.write(90);
delay(pause);
}
void Uptop(){
botpinky.write(0);
toppinky.write(0);
botring.write(60);
topring.write(45);
botbird.write(60);
topbird.write(45);
botpoint.write(60);
toppoint.write(45);
botthumb.write(90);
topthumb.write(90);
wristrot.write(90);
wristang.write(90);
delay(pause);
}
void DownLow(){
botpinky.write(0);
toppinky.write(0);
botring.write(60);
topring.write(45);
botbird.write(60);
topbird.write(45);
botpoint.write(60);
toppoint.write(45);
botthumb.write(90);
topthumb.write(90);
wristrot.write(90);
wristang.write(90);
MafuhCutMeOff();
}
void loop()
{
uint8_t CMDID = 0;
CMDID = DF2301Q.getCMDID();
switch(CMDID){
case 5:
stop();
break;
case 6:
Alphabet();
break;
case 7:
LordVader();
break;
case 8:
GetThreeCoffinsReady();
break;
case 9:
Nixon();
break;
case 10:
LLAP();
break;
case 11:
Uptop();
break;
case 12:
DownLow();
break;
case 13:
Trump();
break;
case 14:
MafuhCutMeOff();
break;
}
}