Other Arduino Codes and Videos by Robojax

What is the frequency of PWM pin of Arduino UNO

دروس آردوینو به فارسی

What is the frequency of PWM pin of Arduino UNO

The video using this sketch showing PWM frequency of Arduino UNO and also rising and falling time of the signal is measured.
  1. Arduino PWM pins
  2. My Arduino Course on Udemy
  3. Patreon Account

 /*
 * this sketch constantly sends PWM signal to all
 * Arduino UNO PWM pins so they can be observed 
 * via oscilloscope
 * 
 * Written by Ahmad Shamshiri
 * on Saturday June 15, 2019 at 16:14
 * in Ajax, Ontario, Canada
 * www.Robojax.com
 * Watch the video instruction:  https://youtu.be/6O9SFvEP6Bs
 */
int pwmPin[] ={3, 5, 6, 9, 10, 11};// all PWM pins
#define controlPin A0

void setup() {
  // Robojax.com
  
  for(int i=0; i<6; i++){
    pinMode(pwmPin[i],OUTPUT);    
  }

 
  Serial.begin(9600);

}

void loop() {
  //Robojax.com
  int potValue = analogRead(controlPin);
  int pwm =map(potValue, 0,1023, 0, 255);
  Serial.print(potValue);//print pot value 0-1023
  for(int i=0; i<6; i++){
    analogWrite(pwmPin[i],pwm);
  } 
  Serial.print(" ");// prints empty space
  Serial.println(pwm);// prnts PWM value 0-255
  //delay(5000);
}



   

If you found this tutorial helpful, please support me so I can continue creating content like this. support me via PayPal