Is my Micro Maestro 6 Safely wired?

I had called Pololu earlier to see if my servo controller went bad (it seems to be the case).
While I’m waiting for replacements, I’d like to make sure that any mistakes I may have made aren’t repeated.
I have attempted to make a block diagram of my project (I am not familiar with how do go about doing this in EAGLE, so I used MsPaint :unamused: )
Right click…view image, etc etc.


I’ve also included the two “drafts” of my code, the first worked fine, but in the second version, when button two was pressed and the function “routine_one()” was called for the first time with the compact stop command in it, the servo controller gave out.

Please note the missing myServos.begin(baudrate) command in the second code’s “void setup()” despite the writing of 0xA4 being present. This goof shouldn’t have physically hurt the Maestro as the worst that could happen is a constant 5v applied to the RX pin…or just garbage data being sent… right ? :blush:

I have a “face” on the 'bot that is a LED matrix, this is driven via the use of two TLC 5940 circuits. Since I draw the shapes with the library manually, there is a lot of code that is irrelevant but included to be thorough.

Also, being used to Parallax’s BASIC Stamp II, my C++ has a strong BASIC accent, if you will. Any tips on C++ grammar and efficiency will not go unappreciated!

Looking forward to joining this community, and hope I can contribute when I can.

~Ben



#include "Tlc5940.h"         // Get ready to drive LEDs.
#include <SoftwareSerial.h>  // Get ready to talk to MP3 player and Servo controller.

SoftwareSerial myVoice(6, 7);     // Let's make the pin for the voice 7. We'll call it myVoice from here on.
SoftwareSerial myServos(4, 5);    // Let's make the pin for the Servos 5. We'll call it myServos from here on.


// Say hello to us (only once, on startup) :

void setup() {
  
  


myVoice.begin(4800);

Tlc.init();

Tlc.set(1,300);

Tlc.update();

delay(3000);


Tlc.set(8,0);

Tlc.set (7,300);
Tlc.update();
delay(1000);
Tlc.set(7,0);
Tlc.set(8,300);
Tlc.update();
myVoice.write(0x01);
delay(5000);
Tlc.clear();


}



// Do your routine:

void loop() {
   
 smileU();
delay(1000);
 smileN();
delay(1000);
 notammusedC();
delay(1000);
 notammusedR();
delay(1000);
 notammusedL();
delay(1000);
 neutral();
delay(1000);
 scared();
delay(1000);
 skeptical();
delay(1000);
 lookup();
delay(1000);
 lookdn();
delay(1000);
 upR();
delay(1000);
 upL();
delay(1000);
 dnR();
delay(1000);
 dnL();
 
delay(1000);





}









// Emotion Fuctions start here


//   content, Smile in shape of U
void smileU() {
Tlc.set(0,300);
Tlc.set(1,0);
Tlc.set(2,0);
Tlc.set(3,300);
Tlc.set(4,300);
Tlc.set(5,0);
Tlc.set(6,0);
Tlc.set(7,300);
Tlc.set(8,0);
Tlc.set(9,300);
Tlc.set(10,300);
Tlc.set(11,0);
Tlc.set(12,0);
Tlc.set(13,0);
Tlc.set(14,0);
Tlc.set(15,0);
Tlc.set(16,300);
Tlc.set(17,0);
Tlc.set(18,0);
Tlc.set(19,0);
Tlc.set(20,0);
Tlc.set(21,300);
Tlc.set(22,0);
Tlc.set(23,0);
Tlc.set(24,0);
Tlc.set(25,300);
Tlc.set(26,0);
Tlc.set(27,0);
Tlc.set(28,0);
Tlc.set(29,300);
Tlc.set(30,0);
Tlc.set(31,300);
Tlc.update();
}
//   smeyezing, Smile in shape of n
void smileN() {
Tlc.set(0,0);
Tlc.set(1,0);
Tlc.set(2,0);
Tlc.set(3,0);
Tlc.set(4,0);
Tlc.set(5,300);
Tlc.set(6,300);
Tlc.set(7,0);
Tlc.set(8,300);
Tlc.set(9,0);
Tlc.set(10,0);
Tlc.set(11,300);
Tlc.set(12,300);
Tlc.set(13,0);
Tlc.set(14,0);
Tlc.set(15,300);
Tlc.update();
}


//  not ammused, looking CENTER
void notammusedC() {
Tlc.set(0,0);
Tlc.set(1,0);
Tlc.set(2,0);
Tlc.set(3,0);
Tlc.set(4,300);
Tlc.set(5,300);
Tlc.set(6,300);
Tlc.set(7,300);
Tlc.set(8,0);
Tlc.set(9,300);
Tlc.set(10,300);
Tlc.set(11,0);
Tlc.set(12,0);
Tlc.set(13,0);
Tlc.set(14,0);
Tlc.set(15,0);
Tlc.set(16,300);
Tlc.set(17,0);
Tlc.set(18,0);
Tlc.set(19,0);
Tlc.set(20,0);
Tlc.set(21,0);
Tlc.set(22,0);
Tlc.set(23,0);
Tlc.set(24,0);
Tlc.set(25,0);
Tlc.set(26,0);
Tlc.set(27,0);
Tlc.set(28,0);
Tlc.set(29,0);
Tlc.set(30,0);
Tlc.set(31,0);
Tlc.update();
}



//  not ammused, looking RIGHT
void notammusedR() {
Tlc.set(0,0);
Tlc.set(1,0);
Tlc.set(2,0);
Tlc.set(3,0);
Tlc.set(4,300);
Tlc.set(5,300);
Tlc.set(6,300);
Tlc.set(7,300);
Tlc.set(8,300);
Tlc.set(9,300);
Tlc.set(10,0);
Tlc.set(11,0);
Tlc.set(12,0);
Tlc.set(13,0);
Tlc.set(14,0);
Tlc.set(15,0);
Tlc.update();
}

//  not ammused, looking LEFT
void notammusedL() {
Tlc.set(0,0);
Tlc.set(1,0);
Tlc.set(2,0);
Tlc.set(3,0);
Tlc.set(4,300);
Tlc.set(5,300);
Tlc.set(6,300);
Tlc.set(7,300);
Tlc.set(8,0);
Tlc.set(9,0);
Tlc.set(10,300);
Tlc.set(11,300);
Tlc.set(12,0);
Tlc.set(13,0);
Tlc.set(14,0);
Tlc.set(15,0);
Tlc.update();
}


//  neutral
void neutral() {
Tlc.set(0,0);
Tlc.set(1,0);
Tlc.set(2,0);
Tlc.set(3,0);
Tlc.set(4,0);
Tlc.set(5,300);
Tlc.set(6,300);
Tlc.set(7,0);
Tlc.set(8,0);
Tlc.set(9,300);
Tlc.set(10,300);
Tlc.set(11,0);
Tlc.set(12,0);
Tlc.set(13,0);
Tlc.set(14,0);
Tlc.set(15,0);
Tlc.set(16,300);
Tlc.set(17,0);
Tlc.set(18,300);
Tlc.set(19,0);
Tlc.set(20,0);
Tlc.set(21,300);
Tlc.set(22,0);
Tlc.set(23,0);
Tlc.set(24,0);
Tlc.set(25,300);
Tlc.set(26,0);
Tlc.set(27,300);
Tlc.set(28,0);
Tlc.set(29,300);
Tlc.set(30,0);
Tlc.set(31,300);
Tlc.update();
}

//  curious or scared
void scared() {
Tlc.set(0,0);
Tlc.set(1,300);
Tlc.set(2,300);
Tlc.set(3,0);
Tlc.set(4,0);
Tlc.set(5,300);
Tlc.set(6,300);
Tlc.set(7,0);
Tlc.set(8,0);
Tlc.set(9,300);
Tlc.set(10,300);
Tlc.set(11,0);
Tlc.set(12,0);
Tlc.set(13,300);
Tlc.set(14,300);
Tlc.set(15,0);
Tlc.update();
}


//  not buying it
void skeptical() {
Tlc.set(0,0);
Tlc.set(1,0);
Tlc.set(2,0);
Tlc.set(3,0);
Tlc.set(4,300);
Tlc.set(5,300);
Tlc.set(6,300);
Tlc.set(7,300);
Tlc.set(8,300);
Tlc.set(9,300);
Tlc.set(10,300);
Tlc.set(11,300);
Tlc.set(12,0);
Tlc.set(13,0);
Tlc.set(14,0);
Tlc.set(15,0);
Tlc.update();
}


//  looking up
void lookup() {
Tlc.set(0,0);
Tlc.set(1,300);
Tlc.set(2,300);
Tlc.set(3,0);
Tlc.set(4,0);
Tlc.set(5,300);
Tlc.set(6,300);
Tlc.set(7,0);
Tlc.set(8,0);
Tlc.set(9,0);
Tlc.set(10,0);
Tlc.set(11,0);
Tlc.set(12,0);
Tlc.set(13,0);
Tlc.set(14,0);
Tlc.set(15,0);
Tlc.update();
}


//  looking down
void lookdn() {
Tlc.set(0,0);
Tlc.set(1,0);
Tlc.set(2,0);
Tlc.set(3,0);
Tlc.set(4,0);
Tlc.set(5,0);
Tlc.set(6,0);
Tlc.set(7,0);
Tlc.set(8,0);
Tlc.set(9,300);
Tlc.set(10,300);
Tlc.set(11,0);
Tlc.set(12,0);
Tlc.set(13,300);
Tlc.set(14,300);
Tlc.set(15,0);
Tlc.update();
}


//  looking upper RIGHT
void upR() {
Tlc.set(0,300);
Tlc.set(1,300);
Tlc.set(2,0);
Tlc.set(3,0);
Tlc.set(4,300);
Tlc.set(5,300);
Tlc.set(6,0);
Tlc.set(7,0);
Tlc.set(8,0);
Tlc.set(9,0);
Tlc.set(10,0);
Tlc.set(11,0);
Tlc.set(12,0);
Tlc.set(13,0);
Tlc.set(14,0);
Tlc.set(15,0);
Tlc.update();
}

//  looking upper LEFT
void upL() {
Tlc.set(0,0);
Tlc.set(1,0);
Tlc.set(2,300);
Tlc.set(3,300);
Tlc.set(4,0);
Tlc.set(5,0);
Tlc.set(6,300);
Tlc.set(7,300);
Tlc.set(8,0);
Tlc.set(9,0);
Tlc.set(10,0);
Tlc.set(11,0);
Tlc.set(12,0);
Tlc.set(13,0);
Tlc.set(14,0);
Tlc.set(15,0);
Tlc.update();
}


//  looking lower RIGHT
void dnR() {
Tlc.set(0,0);
Tlc.set(1,0);
Tlc.set(2,0);
Tlc.set(3,0);
Tlc.set(4,0);
Tlc.set(5,0);
Tlc.set(6,0);
Tlc.set(7,0);
Tlc.set(8,300);
Tlc.set(9,300);
Tlc.set(10,0);
Tlc.set(11,0);
Tlc.set(12,300);
Tlc.set(13,300);
Tlc.set(14,0);
Tlc.set(15,0);
Tlc.update();
}

//  looking lower LEFT
void dnL() {
Tlc.set(0,0);
Tlc.set(1,0);
Tlc.set(2,0);
Tlc.set(3,0);
Tlc.set(4,0);
Tlc.set(5,0);
Tlc.set(6,0);
Tlc.set(7,0);
Tlc.set(8,0);
Tlc.set(9,0);
Tlc.set(10,300);
Tlc.set(11,300);
Tlc.set(12,0);
Tlc.set(13,0);
Tlc.set(14,300);
Tlc.set(15,300);
Tlc.update();
}[/code]


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
This next code uses a set of voltage divided buttons to allow for routine selection
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



[code]//ADKeyboard Module
#include "Tlc5940.h"         // Get ready to drive LEDs.
#include <SoftwareSerial.h>  // Get ready to talk to MP3 player and Servo controller.

SoftwareSerial myVoice(6, 7);     // Let's make the pin for the voice 7. We'll call it myVoice from here on.
SoftwareSerial myServos(4, 5);    // Let's make the pin for the Servos 5. We'll call it myServos from here on.



int adc_key_val[5] ={50, 200, 400, 600, 800 };
int NUM_KEYS = 5;
int adc_key_in;
int key=-1;
int oldkey=-1;


void setup()
{
 myVoice.begin(4800);

Tlc.init();

Tlc.set(1,300);

Tlc.update();

delay(1000);


Tlc.set(8,0);

Tlc.set (7,300);
Tlc.update();
delay(1000);
Tlc.set(7,0);
Tlc.set(8,300);
Tlc.update();

delay(2000);
Tlc.clear();
 
}


void loop()
{
  adc_key_in = analogRead(0);    // read the value from the sensor 
   
  key = get_key(adc_key_in);  // convert into key press
 
  if (key != oldkey)   // if keypress is detected
   {
    delay(50);  // wait for debounce time
    adc_key_in = analogRead(0);    // read the value from the sensor 
    key = get_key(adc_key_in);    // convert into key press
    if (key != oldkey)    
    {   
      oldkey = key;
      if (key >=0){
        
        switch(key)
        {
           case 0:
            faces();
                  break;
           case 1:
            routine_one();   
                  break;
           case 2:  
                  break;
           case 3: 
                  break;      
           case 4: 
                  break;  
        }                
      }
    }
  }
 delay(100);
}
// Convert ADC value to key number
int get_key(unsigned int input)
{
    int k;
    for (k = 0; k < NUM_KEYS; k++)
    {
      if (input < adc_key_val[k])
     {
            return k;
        }
   }
       if (k >= NUM_KEYS)k = -1;  // No valid key pressed
       return k;
}




void faces() {
   
 smileU();
delay(1000);
 smileN();
delay(1000);
 notammusedC();
delay(1000);
 notammusedR();
delay(1000);
 notammusedL();
delay(1000);
 neutral();
delay(1000);
 scared();
delay(1000);
 skeptical();
delay(1000);
 lookup();
delay(1000);
 lookdn();
delay(1000);
 upR();
delay(1000);
 upL();
delay(1000);
 dnR();
delay(1000);
 dnL();
 
delay(1000);





}




// Emotion Fuctions start here


//   content, Smile in shape of U
void smileU() {
Tlc.set(0,300);
Tlc.set(1,0);
Tlc.set(2,0);
Tlc.set(3,300);
Tlc.set(4,300);
Tlc.set(5,0);
Tlc.set(6,0);
Tlc.set(7,300);
Tlc.set(8,0);
Tlc.set(9,300);
Tlc.set(10,300);
Tlc.set(11,0);
Tlc.set(12,0);
Tlc.set(13,0);
Tlc.set(14,0);
Tlc.set(15,0);
Tlc.set(16,300);
Tlc.set(17,0);
Tlc.set(18,0);
Tlc.set(19,0);
Tlc.set(20,0);
Tlc.set(21,300);
Tlc.set(22,0);
Tlc.set(23,0);
Tlc.set(24,0);
Tlc.set(25,300);
Tlc.set(26,0);
Tlc.set(27,0);
Tlc.set(28,0);
Tlc.set(29,300);
Tlc.set(30,0);
Tlc.set(31,300);
Tlc.update();
}
//   smeyezing, Smile in shape of n
void smileN() {
Tlc.set(0,0);
Tlc.set(1,0);
Tlc.set(2,0);
Tlc.set(3,0);
Tlc.set(4,0);
Tlc.set(5,300);
Tlc.set(6,300);
Tlc.set(7,0);
Tlc.set(8,300);
Tlc.set(9,0);
Tlc.set(10,0);
Tlc.set(11,300);
Tlc.set(12,300);
Tlc.set(13,0);
Tlc.set(14,0);
Tlc.set(15,300);
Tlc.update();
}


//  not ammused, looking CENTER
void notammusedC() {
Tlc.set(0,0);
Tlc.set(1,0);
Tlc.set(2,0);
Tlc.set(3,0);
Tlc.set(4,300);
Tlc.set(5,300);
Tlc.set(6,300);
Tlc.set(7,300);
Tlc.set(8,0);
Tlc.set(9,300);
Tlc.set(10,300);
Tlc.set(11,0);
Tlc.set(12,0);
Tlc.set(13,0);
Tlc.set(14,0);
Tlc.set(15,0);
Tlc.set(16,300);
Tlc.set(17,0);
Tlc.set(18,0);
Tlc.set(19,0);
Tlc.set(20,0);
Tlc.set(21,0);
Tlc.set(22,0);
Tlc.set(23,0);
Tlc.set(24,0);
Tlc.set(25,0);
Tlc.set(26,0);
Tlc.set(27,0);
Tlc.set(28,0);
Tlc.set(29,0);
Tlc.set(30,0);
Tlc.set(31,0);
Tlc.update();
}



//  not ammused, looking RIGHT
void notammusedR() {
Tlc.set(0,0);
Tlc.set(1,0);
Tlc.set(2,0);
Tlc.set(3,0);
Tlc.set(4,300);
Tlc.set(5,300);
Tlc.set(6,300);
Tlc.set(7,300);
Tlc.set(8,300);
Tlc.set(9,300);
Tlc.set(10,0);
Tlc.set(11,0);
Tlc.set(12,0);
Tlc.set(13,0);
Tlc.set(14,0);
Tlc.set(15,0);
Tlc.update();
}

//  not ammused, looking LEFT
void notammusedL() {
Tlc.set(0,0);
Tlc.set(1,0);
Tlc.set(2,0);
Tlc.set(3,0);
Tlc.set(4,300);
Tlc.set(5,300);
Tlc.set(6,300);
Tlc.set(7,300);
Tlc.set(8,0);
Tlc.set(9,0);
Tlc.set(10,300);
Tlc.set(11,300);
Tlc.set(12,0);
Tlc.set(13,0);
Tlc.set(14,0);
Tlc.set(15,0);
Tlc.update();
}


//  neutral
void neutral() {
Tlc.set(0,0);
Tlc.set(1,0);
Tlc.set(2,0);
Tlc.set(3,0);
Tlc.set(4,0);
Tlc.set(5,300);
Tlc.set(6,300);
Tlc.set(7,0);
Tlc.set(8,0);
Tlc.set(9,300);
Tlc.set(10,300);
Tlc.set(11,0);
Tlc.set(12,0);
Tlc.set(13,0);
Tlc.set(14,0);
Tlc.set(15,0);
Tlc.set(16,300);
Tlc.set(17,0);
Tlc.set(18,300);
Tlc.set(19,0);
Tlc.set(20,0);
Tlc.set(21,300);
Tlc.set(22,0);
Tlc.set(23,0);
Tlc.set(24,0);
Tlc.set(25,300);
Tlc.set(26,0);
Tlc.set(27,300);
Tlc.set(28,0);
Tlc.set(29,300);
Tlc.set(30,0);
Tlc.set(31,300);
Tlc.update();
}

//  curious or scared
void scared() {
Tlc.set(0,0);
Tlc.set(1,300);
Tlc.set(2,300);
Tlc.set(3,0);
Tlc.set(4,0);
Tlc.set(5,300);
Tlc.set(6,300);
Tlc.set(7,0);
Tlc.set(8,0);
Tlc.set(9,300);
Tlc.set(10,300);
Tlc.set(11,0);
Tlc.set(12,0);
Tlc.set(13,300);
Tlc.set(14,300);
Tlc.set(15,0);
Tlc.update();
}


//  not buying it
void skeptical() {
Tlc.set(0,0);
Tlc.set(1,0);
Tlc.set(2,0);
Tlc.set(3,0);
Tlc.set(4,300);
Tlc.set(5,300);
Tlc.set(6,300);
Tlc.set(7,300);
Tlc.set(8,300);
Tlc.set(9,300);
Tlc.set(10,300);
Tlc.set(11,300);
Tlc.set(12,0);
Tlc.set(13,0);
Tlc.set(14,0);
Tlc.set(15,0);
Tlc.update();
}


//  looking up
void lookup() {
Tlc.set(0,0);
Tlc.set(1,300);
Tlc.set(2,300);
Tlc.set(3,0);
Tlc.set(4,0);
Tlc.set(5,300);
Tlc.set(6,300);
Tlc.set(7,0);
Tlc.set(8,0);
Tlc.set(9,0);
Tlc.set(10,0);
Tlc.set(11,0);
Tlc.set(12,0);
Tlc.set(13,0);
Tlc.set(14,0);
Tlc.set(15,0);
Tlc.update();
}


//  looking down
void lookdn() {
Tlc.set(0,0);
Tlc.set(1,0);
Tlc.set(2,0);
Tlc.set(3,0);
Tlc.set(4,0);
Tlc.set(5,0);
Tlc.set(6,0);
Tlc.set(7,0);
Tlc.set(8,0);
Tlc.set(9,300);
Tlc.set(10,300);
Tlc.set(11,0);
Tlc.set(12,0);
Tlc.set(13,300);
Tlc.set(14,300);
Tlc.set(15,0);
Tlc.update();
}


//  looking upper RIGHT
void upR() {
Tlc.set(0,300);
Tlc.set(1,300);
Tlc.set(2,0);
Tlc.set(3,0);
Tlc.set(4,300);
Tlc.set(5,300);
Tlc.set(6,0);
Tlc.set(7,0);
Tlc.set(8,0);
Tlc.set(9,0);
Tlc.set(10,0);
Tlc.set(11,0);
Tlc.set(12,0);
Tlc.set(13,0);
Tlc.set(14,0);
Tlc.set(15,0);
Tlc.update();
}

//  looking upper LEFT
void upL() {
Tlc.set(0,0);
Tlc.set(1,0);
Tlc.set(2,300);
Tlc.set(3,300);
Tlc.set(4,0);
Tlc.set(5,0);
Tlc.set(6,300);
Tlc.set(7,300);
Tlc.set(8,0);
Tlc.set(9,0);
Tlc.set(10,0);
Tlc.set(11,0);
Tlc.set(12,0);
Tlc.set(13,0);
Tlc.set(14,0);
Tlc.set(15,0);
Tlc.update();
}


//  looking lower RIGHT
void dnR() {
Tlc.set(0,0);
Tlc.set(1,0);
Tlc.set(2,0);
Tlc.set(3,0);
Tlc.set(4,0);
Tlc.set(5,0);
Tlc.set(6,0);
Tlc.set(7,0);
Tlc.set(8,300);
Tlc.set(9,300);
Tlc.set(10,0);
Tlc.set(11,0);
Tlc.set(12,300);
Tlc.set(13,300);
Tlc.set(14,0);
Tlc.set(15,0);
Tlc.update();
}

//  looking lower LEFT
void dnL() {
Tlc.set(0,0);
Tlc.set(1,0);
Tlc.set(2,0);
Tlc.set(3,0);
Tlc.set(4,0);
Tlc.set(5,0);
Tlc.set(6,0);
Tlc.set(7,0);
Tlc.set(8,0);
Tlc.set(9,0);
Tlc.set(10,300);
Tlc.set(11,300);
Tlc.set(12,0);
Tlc.set(13,0);
Tlc.set(14,300);
Tlc.set(15,300);
Tlc.update();
}



void routine_one() {

  
  void neutral();
  delay (200);
  myVoice.write(0x01);
  delay (200);
  myServos.write(0xA4);
  delay (2000);
  void smileN();
}

Hello.

I spoke to you on the phone when you called earlier. Thank you for the additional information. I did not notice any problems with it that would harm the Maestro. Hopefully the replacements will work better for you.

One thing I did notice is that this code probably doesn’t do what you would expect:

void routine_one() {
  void neutral();
  delay (200);
  myVoice.write(0x01);
  delay (200);
  myServos.write(0xA4);
  delay (2000);
  void smileN();
}

When you write “void neutral();” you are merely declaring a function that could be called later, you are not actually calling the function. You can fix this by removing the “void”.

–David