Go Kart Control (reversing solenoid) by qwertbochaffer

Cloned from Sketch Go Kart Control (Servo Steering) by qwertbochaffer

DandyHacks 2016 RC Go Kart Project Code
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.

Embed This Sketch

Use the following HTML code to embed the sketch code above in your blog or website.

<iframe style="height: 510px; width: 100%; margin: 10px 0 10px;" allowTransparency="true" src="https://codebender.cc/embed/sketch:276941" frameborder="0"></iframe>

Embed The Serial Monitor

You can also embed the Serial Monitor section! Just use this HTML code.

<iframe style="height: 510px; width: 100%; margin: 10px 0 10px;" allowTransparency="true" src="https://codebender.cc/embed/serialmonitor" frameborder="0"></iframe>