Write a program to generate a 20ms periodic pulse waveform T
Write a program to generate a 20ms periodic pulse waveform. The program is to acquire a value from the ADC then calculate the TQ for the PWM signal(i.e. variable PWM signal). The program is to then output the PWM pulse wave on OC2.
Solution
Since the exact programming language is not mentioned I am going to writ the program in C++ using Arduino Library.
const int pin=5; //pin 5 is initialized
void setup()
{
pinMode(pin,OUTPUT) //pin 5 is made the output
}
void loop()
{
digitalWrite(pin,HIGH);
delay(20); //20ms delay is produced
digitalWrite(pin,LOW);
delay(20); //20ms delay is produced
