搜索代码

What is the frequency of the PWM pins of an Arduino Uno?

What is the frequency of the PWM pins of an Arduino Uno?

The video uses this sketch to show the PWM frequency of an Arduino Uno and also the rising and falling times of the signal that is measured. Arduino PWM pins My Arduino Course on Udemy Patreon Account
200-What is the frequency of the PWM pins on an Arduino Uno?
语言: C++
/*
 * This sketch constantly sends PWM signals to all
 * Arduino UNO PWM pins so they can be observed 
 * via an 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 an empty space
  Serial.println(pwm);// prints PWM value 0-255
  //delay(5000);
}

资源与参考

尚无可用资源。

文件📁

没有可用的文件。