Hello, I am wondering how to write the code in Arduino for an electric car accelerator pedal. I want it to transfer a specific voltage (up to 5V) and a specific amperage (up to 6-24mA) depending on how far the pedal is pressed. How would I code the pedal to work this way?
I am thinking about using this pedal:
https://www.ebay.com/i/173836803373?chn=ps&norover=1&mkevt=1&mkrid=711-117182-37290-0&mkcid=2&itemid=173836803373&targetid=886109679318&device=c&mktype=pla&googleloc=9032181&poi=&campaignid=9343999164&mkgroupid=98367546447&rlsatarget=aud-622027676548:pla-886109679318&abcId=1139336&merchantid=113390512&gclid=Cj0KCQjwj7v0BRDOARIsAGh37iqJViXVMG11Ub2RMayVte0f4oGVZUYWMf2oItNw7dFIgzMYSv9GHM0aAmKXEALw_wcB
or this one:
Find many great new & used options and get the best deals for Electric Foot Pedal Throttle for gokart, eATV, Quad, electric car, DIY project at the best online prices at eBay! Free shipping for many products!
If a different pedal would work better for this project, please let me know.
Both pedals are direct 5V compatible . The output are voltages that could be direct readed by an analog input pin. Both will work .
This analog input could be coded in the software to translate in a PWM output that could be directed to a PWM Motor driver
Hi, THis is a lot more complicated than you need, but maybe an example. This is for my grandson...
(Have to attach; too big )
BlueCarTest10D.ino (17 KB)