Hi All
I am trying to resurrect an old project from years ago (a Hexapod walker). Teaching my grandson about electronics and coding.
The original project was written PIC Basic (Proton IDE) and I am trying to convert to an Arduino UNO.
The part I am having problems with is converting Subroutines to Functions.
I can write and use functions OK but this part of the software calls subroutines from within a subroutine e.g.
'==============================================================================
' Function Subroutines
'==============================================================================
ForwardStep: 'Go Forwards
GoSub Rest
GoSub LeftSideRaise
GoSub LeftLegsForward
GoSub RightSideRaise
GoSub RightLegsForward
GoSub CentreLegsCentre
GoSub LegsHome 'Return L & R legs to the Home position
Return
I have made the following before void Setup();
#include <Arduino.h>
// Put Function declarations here:
//Go Forwards
//int ForwardStep (int);
void ForwardStep();
//Go Backwards
//int BackwardStep (int);
void BackwardStep();
//Turn Left
//int LeftTurn (int);
void LeftTurn();
//Turn Right
//int RightTurn (int);
void RightTurn();
//Move the Robot Forward, Backward, Left or Right
//int SendToServo (int);
void SendToServo();
//The Centre Tilt Servo
//int CentreLegsCentre (int);
void CentreLegsCentre();
//Move the Right Legs Forwards
//int RightLegsForward (int);
void RightLegsForward();
//Move the Right Legs Backwards
//int RightLegsBackward (int);
void RightLegsBackward();
//Move the Left Legs Forwards
//int LeftLegsForward (int);
void LeftLegsForward();
//Move the Left Legs Backwards
//int LeftLegsBackward (int);
void LeftLegsBackward();
//Tilt the Right Hand Side
//int RightSideRaise (int);
void RightSideRaise();
//Tilt the Left Hand Side
//int LeftSideRaise (int);
void LeftSideRaise();
//Return Left & Right Legs into the Centre Position
//int LegsHome (int);
void LegsHome();
//Put ALL of the Legs into the Centre Position
//int Rest (int);
void Rest();
//This Routine Holds ALL of the Servomotors in the Centre Position
//int Hold (int);
void Hold();
This compiles OK but I’m having problems with the ‘subroutines’
Any help appreciated.
Thanks
Mike