Allows RC Overrides to be in place in order to control the throttle and ideally steering for a Go Kart using an Alltrax AXE motor controller and a custom DIY Servo from a drill gear-motor and potentiometer, driven by a hobby ESC (in our case, the Hobbywing Quicrun 1060 BLDC Controller). The throttle control is a 0-5V golf cart foot pedal Hall Effect throttle, so analogRead is used to send (or fake) voltage signals to the controller.
This program has a few jobs: RC OFF: - Transfer the throttle signal from our pedal to the controller with no modifications (analogRead is mapped directly from 10bit to 8bit and fed to analogWrite) - Steering motor is disconnected via an RC Relay - If Ch 3 is on, switch to RC mode and close the RC relay.
RC ON: - Read PWM signals from our RC Receiver on Ch 1, 2, 3 - Send Ch 1 signal to the Throttle (FWD only, reversing will be done with a reversing solenoid switch) - Read the steering position from a POT on the steering column - Interpret error from the position indicated by Ch 2 of the reciever - Close that error (PID control loop with the Hobbywing ESC via Servo lib) - If Ch 3 is off, switch to manual mode and open the RC relay.