Other Arduino Codes and Videos by Robojax
/*
* 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