Hi all,
After some more digging around I found this thread here:
forums.trossenrobotics.com/sh…n-should-I-use!
In there KurtE attached a example zip file containing a setup that uses RC as input.
Within the Hex_Cfg.h file I found the follow code:
// Define the Pins that are used by the RC Receiver
const byte caRCPins] PROGMEM = {6, 7, 8, 9, 10, 11};
#define RCPIN_COUNT (sizeof(caRCPins)/sizeof(caRCPins[0]))
This is presumably the define for pins on the arduino mega 2560 am I correct?
looking at this picture here:
electroschematics.com/wp-…560-Pinout.jpg
pin 6-11 are the physical pins located towards the top side of the board am I correct? (all PWM capable pins).
in _phoenix_Input_RC.h, I found the follow code:
// Include the Pin Change code. Can also tell it not to define some Interrupt vectors...
#define NO_PINCHANGE_0 // No Pin changes on 0-7 - Typically Analog pins A0-A5.
// #define NO_PINCHANGE_1 // No Pin changes on 9-15 - On non-mega: D8-13
// #define NO_PINCHANGE_2 // No Pin Changes on 16-23 - non-mega: D0-7
//#include "PCInt.h"
what do they do? with so many pins on the mega 2560 I would assume that you don’t need to “change pins”? I have trouble understanding this portion of the code if someone can jump in and maybe shine some light on this.
The second part of my initial question / problem remains tho:
Is it possible to use the mega 2560 as the servo driver without a dedicated servo controller? If this is not possible them I have misunderstood the code / description, please feel free to let me know so I don’t waste anymore time on it.
I am assuming that I will need to put #include “_Phoenix_Driver_ServoEx.h” in the main config header file? What else do I have to change / config?
I keep clinging on the hope to not use a dedicated servo controller because of my budget limit, and I found this bit of code with comment in the _Phoenix_Driver_SSC32.h, it gave me hope that what I wanted is indeed possible:
//Project Lynxmotion Phoenix
//
// Servo Driver - This version is setup to use the SSC-32 to control
// the servos.
//================================================== ==================
//Servo Pin numbers - May be SSC-32 or actual pins on main controller, depending on configuration.
#ifdef QUADMODE
const byte cCoxaPin] PROGMEM = {
cRRCoxaPin, cRFCoxaPin, cLRCoxaPin, cLFCoxaPin};
const byte cFemurPin] PROGMEM = {
cRRFemurPin, cRFFemurPin, cLRFemurPin, cLFFemurPin};
const byte cTibiaPin] PROGMEM = {
cRRTibiaPin, cRFTibiaPin, cLRTibiaPin, cLFTibiaPin};
#ifdef c4DOF
const byte cTarsPin] PROGMEM = {
cRRTarsPin, cRFTarsPin, cLRTarsPin, cLFTarsPin};
#endif
#else
const byte cCoxaPin] PROGMEM = {
cRRCoxaPin, cRMCoxaPin, cRFCoxaPin, cLRCoxaPin, cLMCoxaPin, cLFCoxaPin};
const byte cFemurPin] PROGMEM = {
cRRFemurPin, cRMFemurPin, cRFFemurPin, cLRFemurPin, cLMFemurPin, cLFFemurPin};
const byte cTibiaPin] PROGMEM = {
cRRTibiaPin, cRMTibiaPin, cRFTibiaPin, cLRTibiaPin, cLMTibiaPin, cLFTibiaPin};
#ifdef c4DOF
const byte cTarsPin] PROGMEM = {
cRRTarsPin, cRMTarsPin, cRFTarsPin, cLRTarsPin, cLMTarsPin, cLFTarsPin};
#endif
#endif
I assume the above code links to the following part of code in Hex_Cfg.h?
// If we are using a SSC-32 then:
// If were are running on an Arduino Mega we will use one of the hardware serial port, default to Serial1 above.
// If on Non mega, if the IO pins are set to 0, we will overload the hardware Serial port
// Else we will user SoftwareSerial to talk to the SSC-32
#define cSSC_OUT 0 //Output pin for (SSC32 RX) on BotBoard (Yellow)
#define cSSC_IN 0 //Input pin for (SSC32 TX) on BotBoard (Blue)
//================================================== ==================
//[SSC PIN NUMBERS]
#define cRRCoxaPin 0 //Rear Right leg Hip Horizontal
#define cRRFemurPin 1 //Rear Right leg Hip Vertical
#define cRRTibiaPin 2 //Rear Right leg Knee
#define cRRTarsPin 3 // Tar
#define cRMCoxaPin 4 //Middle Right leg Hip Horizontal
#define cRMFemurPin 5 //Middle Right leg Hip Vertical
#define cRMTibiaPin 6 //Middle Right leg Knee
#define cRMTarsPin 7 // Tar
#define cRFCoxaPin 8 //Front Right leg Hip Horizontal
#define cRFFemurPin 9 //Front Right leg Hip Vertical
#define cRFTibiaPin 10 //Front Right leg Knee
#define cRFTarsPin 11 // Tar
#define cLRCoxaPin 16 //Rear Left leg Hip Horizontal
#define cLRFemurPin 17 //Rear Left leg Hip Vertical
#define cLRTibiaPin 18 //Rear Left leg Knee
#define cLRTarsPin 19 // Tar
#define cLMCoxaPin 20 //Middle Left leg Hip Horizontal
#define cLMFemurPin 21 //Middle Left leg Hip Vertical
#define cLMTibiaPin 22 //Middle Left leg Knee
#define cLMTarsPin 23 // Tar
#define cLFCoxaPin 24 //Front Left leg Hip Horizontal
#define cLFFemurPin 25 //Front Left leg Hip Vertical
#define cLFTibiaPin 26 //Front Left leg Knee
#define cLFTarsPin 27 // Tar
Does it mean if I #include “_Phoenix_Driver_ServoEx.h” the the above “SSC pin numbers” then correspond to actual physical pin numbers on the mega 2560?
Can I please have some guidance / pointers?
Thanks for your help in advance.
Kind regards
powerover