Skip to content

Making a FastPWM Object

willBoyd8 edited this page Mar 31, 2017 · 2 revisions

Creating a fastPWM object is easy! Here's an example:

#include "fastPWM.h"

fastPWM example = fastPWM(5, 0, false, 0, 0, 100, 200, 5, 95);

The above constructor is broken down into the following pieces of info

Number Name Usage
0 Pin The pin to output PWM to. Must be a Digital (~) pin
1 State The current state on the FastPWM. See ~~~States~~~
2 Initialized Bool representing whether the FastPWM is transmitting at the moment. Starts as false
3 Value The output value on the PWM pin
4 OCR Currently does nothing. Will eventually dictate which register to use
5-6 mapInHigh/mapOutHigh The highest value coming in and the highest value going out
7-8 lowWarning/highWarning The values at which an override will take place, in terms of the input values

With all these entered, the fastPWM object is now entirely ready for use. Let's use it

Clone this wiki locally