#include "TimerOne.h"
void setup()
{
pinMode(9, OUTPUT);
Timer1.initialize(20); // initialize timer1, and set at 50kHz
Timer1.pwm(9, 256); // setup pwm on pin 9, 25% duty cycle
Timer1.pwm(10, 256); // setup pwm on pin 10, 25% duty cycle
}
void loop()
{
// your program here...
}
following the image. How can I code to get PWM signal like that image ?
Sorry I don't understand the question.
A normal analogWrite call will change the PWM duty cycle.
Are you asking how to get two PWM signals to be 180 degrees out of phase?
system
October 15, 2014, 12:51am
4
Those signals are not 180 out of phase. They are SHIFTED but I can't read the Time/ division on my cell phone. Could they be 120 degres out of phase?
I think you need some external hardware,
or create pulses with 200KHz timing.
pulse edge every 5uS, could be difficult.
I think 100KHz not too hard for a PWM output?
I can't tell from that tiny image what is going on, exactly. The OP is going to have to give us more information.