login

online now

We have 122 guests and no members online

search

 
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Daisy Bell

Daisy Bell 5 years 10 months ago #156

Here's the arduino sketch for "Daisy Bell." Keep in mind on aRDuiX, pins 3 and 11 are tied up by the motor board so I had to reroute sndPin to 5. The last functions (doYellowFlash, justStop, etc.) are related to the intention lights and motion so unless you're using a compatible motor system you may wish to remove them.
[quote]

#include <GinSing.h>

GinSing         GS;

GinSingVoice *  v; 
GinSingPreset * fx; 
GinSingPoly *   p; 
GinSingSynth *  s;
GinSingMaster * m;

[color=#7E7E7E]//Pin assignments[/color]
#define ovfPin  2[color=#7E7E7E]//GinSing Overflow.  More or less unused[/color]
[color=#CC6600]int[/color] speedPinA= 3;[color=#7E7E7E]//A is Right Side[/color]
#define rcvPin  4[color=#7E7E7E]//Ginsing recieve.  Also unused.[/color]
#define sndPin  5[color=#7E7E7E]//Ginsing Send.  Rerouted from 3 (Ginsing) to 5 (Arduino)-be sure to wire correctly if undone.[/color]
[color=#CC6600]int[/color] speedPinB= 11;[color=#7E7E7E]//B is Left Side[/color]
[color=#CC6600]int[/color] directionPinA = 12; [color=#7E7E7E]//A is Right Side[/color]
[color=#CC6600]int[/color] directionPinB = 13;  [color=#7E7E7E]//B is Left Side[/color]
[color=#7E7E7E]//Head LEDs...[/color]
#define greenPinFL 53
#define greenPinFR 51
#define greenPinRR 49
#define greenPinRL 47
#define yellowPin 45
#define redPin 43

[color=#CC6600]void[/color] [color=#CC6600][b]setup[/b][/color](){
  [color=#CC6600]pinMode[/color](greenPinFL, [color=#006699]OUTPUT[/color]);  
  [color=#CC6600]pinMode[/color](greenPinFR, [color=#006699]OUTPUT[/color]);  
  [color=#CC6600]pinMode[/color](greenPinRR, [color=#006699]OUTPUT[/color]);  
  [color=#CC6600]pinMode[/color](greenPinRL, [color=#006699]OUTPUT[/color]);
  [color=#CC6600]pinMode[/color](yellowPin, [color=#006699]OUTPUT[/color]);
  [color=#CC6600]pinMode[/color](redPin, [color=#006699]OUTPUT[/color]);
  [color=#CC6600]pinMode[/color] (directionPinA, [color=#006699]OUTPUT[/color]);[color=#7E7E7E]//right wheel direction[/color]
  [color=#CC6600]pinMode[/color] (speedPinA, [color=#006699]OUTPUT[/color]);[color=#7E7E7E]//right wheel speed[/color]
  [color=#CC6600]pinMode[/color] (directionPinB, [color=#006699]OUTPUT[/color]);[color=#7E7E7E]//keft wheel direction[/color]
  [color=#CC6600]pinMode[/color] (speedPinB, [color=#006699]OUTPUT[/color]);[color=#7E7E7E]//left wheel speed[/color]
  [color=#CC6600]digitalWrite[/color] (directionPinA, [color=#006699]LOW[/color]);
  [color=#CC6600]digitalWrite[/color] (directionPinB, [color=#006699]LOW[/color]);

  [color=#7E7E7E]//ginsing setup[/color]
  GS.[color=#CC6600]begin[/color]( rcvPin , sndPin , ovfPin );
  v  = GS.getVoice ();
  fx = GS.getPreset();
  p  = GS.getPoly  ();
  s  = GS.getSynth ();
  m  = GS.getMaster();

}
[color=#CC6600]void[/color] [color=#CC6600][b]loop[/b][/color](){
  doYellowFlash();
  v->[color=#CC6600]begin[/color]();

  doLeftTurn();
  v->setNote ( G_3 );
  GSAllophone Dai[] = {
    _DE , _AE,_AE,_AE, _ENDPHRASE                  
  };
  v->speak (Dai);

  v->setNote ( E_3 );
  GSAllophone sy[] = {
    _Z , _EE,_EE,_EE,_EE,_EE,_EE, _ENDPHRASE                  
  };
  v->speak (sy);
  [color=#CC6600]delay[/color](500);
  doRightTurn();
  v->setNote ( C_3 );
  GSAllophone Dai2[] = {
    _DE , _AE,_AE,_AE, _ENDPHRASE                  
  };
  v->speak (Dai2);

  v->setNote ( G_2 );
  GSAllophone sy2[] = {
    _Z , _EE,_EE,_EE,_EE,_EE,_EE, _ENDPHRASE                  
  };
  v->speak (sy2);
  doForward();
  [color=#CC6600]delay[/color](500);
  v->setNote ( A_2 );
  GSAllophone give[] = {
    _GE , _I , _V, _ENDPHRASE                  
  };
  v->speak (give);

  v->setNote (B_2 );
  GSAllophone me[] = {
    _M , _EE , _EE , _ENDPHRASE                  
  };
  v->speak (me);

  v->setNote (C_3 );
  GSAllophone your[] = {
    _EE , _OR , _ENDPHRASE                  
  };
  v->speak (your);

  doBackUp();
  v->setNote (A_2 );
  GSAllophone an[] = {
    _A ,_A ,_A , _NE , _ENDPHRASE                  
  };
  v->speak (an);

  v->setNote (C_3 );
  GSAllophone swer[] = {
    _SE , _ER , _ENDPHRASE                  
  };
  v->speak (swer);

  justStop();
  v->setNote (G_2 );
  GSAllophone doo[] = {
    _DO , _UE,_UE,_UE,_UE,_UE,_UE, _PA0, _ENDPHRASE                  
  };
  v->speak (doo);
  [color=#CC6600]delay[/color] (1000);

  doRightTurn();

  v->setNote (D_3 );
  GSAllophone Im[] = {
    _IE,_IE,_IE,_M, _ENDPHRASE                  
  };
  v->speak (Im);

  v->setNote (G_3 );
  GSAllophone half[] = {
    _HO , _A, _A , _F,  _ENDPHRASE                  
  };
  v->speak (half);

  doLeftTurn();
  v->setNote (E_3 );
  GSAllophone cra[] = {
    _KE , _R , _AE ,_AE , _Y,  _ENDPHRASE                  
  };
  v->speak (cra);

  v->setNote (C_3 );
  GSAllophone zy[] = {
    _Z , _EE,_EE,_EE, _ENDPHRASE                  
  };
  v->speak (zy);

  v->setNote (A_2);
  GSAllophone all[] = {
    _HO, _AA , _LO  , _ENDPHRASE                  
  };
  v->speak (all);

  v->setNote (B_2);
  GSAllophone fore[] = {
    _F , _OR , _ENDPHRASE                  
  };
  v->speak (fore);

  v->setNote (C_3);
  GSAllophone the[] = {
    _THH , _EE  , _ENDPHRASE                  
  };
  v->speak (the);


  justStop();
  v->setNote (D_3);
  GSAllophone love[] = {
    _LO , _U , _U, _U ,_U , _U, _U , _V , _ENDPHRASE                  
  };
  v->speak (love);

  v->setNote (E_3);
  GSAllophone of[] = {
    _U , _V , _ENDPHRASE                  
  };
  v->speak (of);

  v->setNote (D_3);
  GSAllophone you[] = {
    _Y , _UE, _UE, _UE,_UE, _UE, _UE, _PA2,_ENDPHRASE                  
  };
  v->speak (you);  
  [color=#CC6600]delay[/color] (1000);

  doForward();
  v->setNote (E_3);
  GSAllophone it[] = {
    _I , _T, _ENDPHRASE                  
  };
  v->speak (it);  

  v->setNote (F_3);
  GSAllophone wont[] = {
    _W , _OE, _NE ,_T, _ENDPHRASE                  
  };
  v->speak (wont); 

  v->setNote (E_3);
  GSAllophone BE[] = {
    _BE , _EE , _ENDPHRASE                  
  };
  v->speak (BE);    

  v->setNote (D_3);
  GSAllophone A[] = {
    _AE ,_U, _ENDPHRASE                  
  };
  v->speak (A); 

  v->setNote (G_3);
  GSAllophone STYL[] = {
    _SE , _T , _IE ,_IE ,_IE , _LO , _ENDPHRASE                  
  };
  v->speak (STYL); 

  v->setNote (E_3);
  GSAllophone ISH[] = {
    _I , _SH , _ENDPHRASE                  
  };
  v->speak (ISH); 

  justStop();
  v->setNote (D_3);
  GSAllophone MAR[] = {
    _M ,_E, _R , _ENDPHRASE                  
  };
  v->speak (MAR); 

  v->setNote (C_3);
  GSAllophone IAGE[] = {
    _I,_I,_I,_I,_I,_I,_J,_PA2,_ENDPHRASE                  
  };
  v->speak (IAGE); 
  [color=#CC6600]delay[/color] (1000);
  doLeftTurn();
  v->setNote (D_3);
  GSAllophone I[] = {
    _IE,_IE,_ENDPHRASE                  
  };
  v->speak (I); 

  v->setNote (E_3);
  GSAllophone CANT[] = {
    _KE , _A ,_A ,_A , _NE  , _T,_ENDPHRASE                  
  };
  v->speak (CANT); 

  v->setNote (C_3);
  GSAllophone UH[] = {
    _U,_U,_ENDPHRASE                  
  };
  v->speak (UH);     

  v->setNote (A_2);
  GSAllophone FORD[] = {
    _F , _OR,_OR,_OR,_OD,_ENDPHRASE                  
  };
  v->speak (FORD); 

  v->setNote (C_3);
  v->speak (UH); 

  v->setNote (A_2);
  GSAllophone CARE[] = {
    _EK , _E,_R ,_ENDPHRASE                  
  };
  v->speak (CARE); 

  v->setNote (G_2);
  v->speak (IAGE);

  justStop();
  [color=#CC6600]delay[/color](1000); 

  doBackUp();
  v->setNote (G_2);
  GSAllophone but[] = {
    _BO,_U,_T ,_ENDPHRASE                  
  };
  v->speak (but); 

  v->setNote (C_3);
  GSAllophone YOULL[] = {
    _Y , _UE, _UE, _UE, _LO ,_ENDPHRASE                  
  };
  v->speak (YOULL); 

  v->setNote (E_3);
  GSAllophone LOOK[] = {
    _LO , _OO , _OK  ,_ENDPHRASE                  
  };
  v->speak (LOOK); 

  v->setNote (D_3);
  GSAllophone SWEET[] = {
    _SE , _W , _EE,_T ,_PA2,_ENDPHRASE                  
  };
  v->speak (SWEET);

  doForward();
  v->setNote (G_2);
  GSAllophone UP[] = {
    _U , _PO ,_ENDPHRASE                  
  };
  v->speak (UP); 

  v->setNote (C_3);
  GSAllophone ON[] = {
    _AA , _AA , _AA , _NO  ,_ENDPHRASE                  
  };
  v->speak (ON);

  v->setNote (C_3);
  GSAllophone THE[] = {
    _THH , _U  ,_ENDPHRASE                  
  };
  v->speak (THE);

  v->setNote (D_3);
  GSAllophone SEET[] = {
    _SE , _EE,_T ,_PA2,_ENDPHRASE                  
  };
  v->speak (SEET); 
  doLeftTurn();
  v->setNote (E_3);
  v->speak (of);

  v->setNote (F_3);
  v->speak (A);

  v->setNote (G_3);
  GSAllophone Bot[] = {
    _BO , _AA,_T ,_ENDPHRASE                  
  };
  v->speak (Bot); 

  v->setNote (E_3);
  GSAllophone SICK[] = {
    _SE , _I , _EK,_ENDPHRASE                  
  };
  v->speak (SICK);

  v->setNote (C_3);
  GSAllophone LE[] = {
    _U,_U,_U,_LO,_ENDPHRASE                  
  };
  v->speak (LE);

  v->setNote (D_3);
  GSAllophone BUILT[] = {
    _BE , _I ,_I ,_I , _LO,_T,_ENDPHRASE                  
  };
  v->speak (BUILT); 

  v->setNote (G_2);
  v->speak (fore);

  v->setNote (C_3);
  GSAllophone two[] = {
    _T , _UE , _UE, _UE , _UE,  _PA0, _ENDPHRASE                  
  };
  v->speak (two);   

  justStop();
  [color=#CC6600]delay[/color] (4000);
}






[color=#CC6600]void[/color] doLeftTurn(){  
  [color=#CC6600]analogWrite[/color] (speedPinA, 250);
  [color=#CC6600]analogWrite[/color] (speedPinB, 175); 
  [color=#CC6600]digitalWrite[/color] (directionPinA, [color=#006699]HIGH[/color]);
  [color=#CC6600]digitalWrite[/color] (directionPinB, [color=#006699]LOW[/color]);
  [color=#CC6600]digitalWrite[/color](greenPinFR, [color=#006699]LOW[/color]);
  [color=#CC6600]digitalWrite[/color](greenPinFL, [color=#006699]HIGH[/color]);
  [color=#CC6600]digitalWrite[/color](greenPinRL, [color=#006699]LOW[/color]);
  [color=#CC6600]digitalWrite[/color](greenPinRR, [color=#006699]HIGH[/color]);
  [color=#CC6600]digitalWrite[/color](yellowPin,[color=#006699]LOW[/color]);
  [color=#CC6600]digitalWrite[/color](redPin, [color=#006699]LOW[/color]);
}

[color=#CC6600]void[/color] doRightTurn(){
  [color=#CC6600]analogWrite[/color] (speedPinA, 250);
  [color=#CC6600]analogWrite[/color] (speedPinB, 175); 
  [color=#CC6600]digitalWrite[/color] (directionPinB, [color=#006699]HIGH[/color]);
  [color=#CC6600]digitalWrite[/color](greenPinFR, [color=#006699]HIGH[/color]);
  [color=#CC6600]digitalWrite[/color](greenPinFL, [color=#006699]LOW[/color]);
  [color=#CC6600]digitalWrite[/color](greenPinRL, [color=#006699]HIGH[/color]);
  [color=#CC6600]digitalWrite[/color](greenPinRR, [color=#006699]LOW[/color]);
  [color=#CC6600]digitalWrite[/color](yellowPin,[color=#006699]LOW[/color]);
  [color=#CC6600]digitalWrite[/color](redPin, [color=#006699]LOW[/color]);

}

[color=#CC6600]void[/color] doBackUp(){
  [color=#CC6600]analogWrite[/color] (speedPinA, 250);
  [color=#CC6600]analogWrite[/color] (speedPinB, 175);  
  [color=#CC6600]digitalWrite[/color] (directionPinB, [color=#006699]HIGH[/color]);
  [color=#CC6600]digitalWrite[/color] (directionPinA, [color=#006699]HIGH[/color]);
  [color=#CC6600]digitalWrite[/color](greenPinFR, [color=#006699]LOW[/color]);
  [color=#CC6600]digitalWrite[/color](greenPinFL, [color=#006699]LOW[/color]);
  [color=#CC6600]digitalWrite[/color](greenPinRL, [color=#006699]HIGH[/color]);
  [color=#CC6600]digitalWrite[/color](greenPinRR, [color=#006699]HIGH[/color]);
  [color=#CC6600]digitalWrite[/color](yellowPin,[color=#006699]LOW[/color]);
  [color=#CC6600]digitalWrite[/color](redPin, [color=#006699]LOW[/color]);
}

[color=#CC6600]void[/color] doForward(){
  [color=#CC6600]analogWrite[/color] (speedPinA, 250);
  [color=#CC6600]analogWrite[/color] (speedPinB, 175);  
  [color=#CC6600]digitalWrite[/color] (directionPinB, [color=#006699]LOW[/color]);
  [color=#CC6600]digitalWrite[/color] (directionPinA, [color=#006699]LOW[/color]);
  [color=#CC6600]digitalWrite[/color](greenPinFR, [color=#006699]HIGH[/color]);
  [color=#CC6600]digitalWrite[/color](greenPinFL, [color=#006699]HIGH[/color]);
  [color=#CC6600]digitalWrite[/color](greenPinRL, [color=#006699]LOW[/color]);
  [color=#CC6600]digitalWrite[/color](greenPinRR, [color=#006699]LOW[/color]);
  [color=#CC6600]digitalWrite[/color](yellowPin,[color=#006699]LOW[/color]);
  [color=#CC6600]digitalWrite[/color](redPin, [color=#006699]LOW[/color]);
}

[color=#CC6600]void[/color] justStop(){
  [color=#CC6600]analogWrite[/color] (speedPinA, 0);
  [color=#CC6600]analogWrite[/color] (speedPinB, 0); 
  [color=#CC6600]digitalWrite[/color](greenPinFR, [color=#006699]LOW[/color]);
  [color=#CC6600]digitalWrite[/color](greenPinFL, [color=#006699]LOW[/color]);
  [color=#CC6600]digitalWrite[/color](greenPinRL, [color=#006699]LOW[/color]);
  [color=#CC6600]digitalWrite[/color](greenPinRR, [color=#006699]LOW[/color]);
  [color=#CC6600]digitalWrite[/color](yellowPin,[color=#006699]LOW[/color]);
  [color=#CC6600]digitalWrite[/color](redPin, [color=#006699]HIGH[/color]);
}

[color=#CC6600]void[/color] doYellowFlash(){
  [color=#CC6600]for[/color] ([color=#CC6600]int[/color] i=1;i<6;i++){
    [color=#CC6600]digitalWrite[/color](yellowPin,[color=#006699]HIGH[/color]);
    [color=#CC6600]delay[/color](200);
    [color=#CC6600]digitalWrite[/color](yellowPin,[color=#006699]LOW[/color]);
    [color=#CC6600]delay[/color](200);
  }
}













[/quote]
The administrator has disabled public write access.
  • Page:
  • 1
Time to create page: 0.278 seconds