EFeru / hoverboard-firmware-hack-FOC

With Field Oriented Control (FOC)
GNU General Public License v3.0
1.05k stars 876 forks source link

Potentiometer and a reverse button #476

Open valerivp opened 3 months ago

valerivp commented 3 months ago

Variant

ADC

Control type

None

Control mode

None

Description

How to make a potentiometer on one channel and a reverse button on the second channel? The button is a two-position switch

EFeru commented 3 months ago

Connect the reverse switch to the 2nd channel (one pin at 3.3v and the other pin connected to channel 2 and a pull down resistor). Then there are 2 solutions:

  1. Update the code to detect when the switch is on or off. Flip the sign of the 1st channel based on the switch value. Don't forget to disable/remove the other functionality for the 2nd channel (like the steering mix)

  2. Use Variant Hovercar, and turn the switch twice on and off quickly. The throttle Channel will be reversed. Turn the switch twice on off and it will reverse back. (You can use a pulse button, instead of a toggle switch)