Test Feedback 360° Servos

Only for FEEDBACK 360° SERVOS
If you are using external encoders, go to External Encoder Test instead.

It's time to test your Feedback 360° servos' encoder signal connections, to make sure they are proper working order.  If all is well, the example program below will cause the built-in LED on the Activity Board to blink on and off when you gently turn a wheel by hand.  

  • In SimpleIDE, open Test Feedback 360 Servo Connections.side
  • Turn the robot's PWR switch to Position 2.
  • In SimpleIDE, click the Load EEPROM & Run button.
  • With your hand, gently twist the ActivityBot's left wheel. This should make the P26 LED turn on and off as you rotate the wheel.
  • Repeat for the right wheel.  Turning the right wheel should make the P27 LED turn on and off.

/*
 Test Feedback Connections.c
*/

                                                                            
#include "simpletools.h"                     // Library - simpletools
#include "abdrive360.h"                      // Library - abdrive360

int left;                                    // Current/previous angles
int right;
int leftPrev;
int rightPrev;

int main()                                   // Main function
{
 drive_getTicks(&left, &right);              // Get current encoder ticks
 leftPrev = left;                            // Set previous values
 rightPrev = right;
 
 while (1)                                   // Main loop
 {
   drive_getTicks(&left, &right);            // Get current encoder ticks
   if (left != leftPrev)                     // If left different from previous
   {
     toggle(26);                             // Toggle P26 LED light
   }

   if (right != rightPrev)                   // If right different from previous
   {
     toggle(27);                             // Toggle P27 LED light
   }

   leftPrev = left;                          // Save previous values
   rightPrev = right;
 }
}

 

If It Doesn't Work...

Here are some symptoms and causes:

P26 light stays off while turning the left wheel.

  • The left feedback signal wire may be plugged into the wrong pin on the P14 servo port.
  • The left feedback singal wire may be plugged into the P15 servo port instead.
  • The left servo's 3-pin cable might be plugged in backwards.
  • The shunt jumper might be missing or incorrectly set on the voltage selectgor pins next to the P12/P13 servo port.

P27 light stays off while turning the right wheel.

  • The right feedback signal wire may be plugged into the wrong pin on the P15 servo port.
  • The right feedback signal wire may be plugged into the P14 servo port instead.
  • The right servo's 3-pin cable might be plugged in backwards.
  • The shunt jumper might be missing or incorrectly set on the voltage selector pins next to the P12/P13 servo port.

P27 light instead of P26 light blinks while turning the left wheel (or vice versa).

  • The encoder cables are swapped! Switch the encoder cables plugged into P14 and P15.

If Both Encoders Work

Congratulations! It is time to calibrate your ActivityBot.