Hi everyone, I've just got an assignment to build a controller together with Arduino mega 2560 (The only piece we have in lab) and drive a BLDC motor for a small car. The motor is estimated between 200W to 600w. And the basic function includes controlling the motor to run at it's most efficiency speed/output. (although this is a later part of the story.)
I need to build up a PWM controller which adjust the motor speed to the speed reference signal input to the controller. And the first step is to get a code which runs inside the Arduino for such application. Understand that there are huge amount of information about Arduino controller and I'm really lost in those thousands of search result. Can someone help me with a PWM code that is already workable inside the mega 2560 so that I can test it and learn from there?