#include "pwmWrite.h"
const byte pwmPin[8] = {21, 19, 18, 5, 16, 4, 2, 15};
const uint16_t duty[8] = {64, 128, 192, 256, 320, 384, 448, 512};
const uint16_t phase[8] = {873, 873, 582, 582, 291, 291, 0, 0};
const uint32_t frequency = 5000;
const byte resolution = 10;
Pwm pwm = Pwm();
void setup() {
Serial.begin(115200);
//pwm.pause();
for (int i = 0; i < 8; i++) {
//pwm.attachPin(pwmPin[i]);
pwm.write(pwmPin[i], duty[i], frequency, resolution, phase[i]);
}
//pwm.resume();
//pwm.printConfig();
//pinMode(16, INPUT);
//digitalRead(16);
//Serial.println(pwm.getPinStatus(16));
//Serial.println(pwm.attachPin(16));
// pwm.write(21, 0, 50, 16);
pwm.printConfig();
// pwm.setFrequency(21, 901);
Serial.println();
Serial.println(pwm.writeServo(21, 0), DEC);
delay(200);
Serial.println(pwm.writeServo(21, 90), DEC);
delay(200);
Serial.println(pwm.writeServo(21, 179.95), DEC);
delay(200);
Serial.println();
Serial.println(pwm.writeServo(21, 544), DEC);
delay(200);
Serial.println(pwm.writeServo(21, 1472), DEC);
delay(200);
Serial.println(pwm.writeServo(21, 2400), DEC);
Serial.println();
pwm.printConfig();
//Serial.print("Config: ");
//for (int i = 0; i < 8; i++) {
// Serial.print(pwm.getPinStatus(pwmPin[i]));
// Serial.print(", ");
//}
//pwm.setConfigDefaults();
//pwm.printConfig();
}
void loop() {
}