11/15/2026
AVR_PWM
library enables you to use Hardware-based PWM channels on AVR-based boards, such as Nano, UNO, Mega, Leonardo, 32u4, etc., to create and output PWM.
The most important feature is they're purely hardware-based PWM channels, supporting very high PWM frequencies
https://docs.arduino.cc/libraries/avr_pwm/
analogWrite()
Writes an analog value (PWM wave) to a pin. Can be used to light a LED at varying brightness or drive a motor at various speeds. After a call to analogWrite(), the pin will generate a steady rectangular wave of the specified duty cycle until the next call to analogWrite() (or a call to digitalRead() or digitalWrite()) on the same pin.
https://docs.arduino.cc/language-reference/en/functions/analog-io/analogWrite/
11/13/2026
PWM using PWM Library
#include <PWM.h>
int led = 9;
int32_t frequency =1000;
///// void setup()
{
InitTimersSafe();
pinMode(9,OUTPUT);
bool success = SetPinFrequencySafe(led, frequency);
if(success){
pinMode(13,OUTPUT);
digitalWrite(13,HIGH);}
}
//// void loop(){
//analogWrite(9,127);
pwmWrite(led,127);
}
#define pinLED 3
Digital (PWM-);
Ground and pin-3;
bool success = SetPinFrequencySafe(led, frequency);
analog write
Pins 3,5,6,9,10, 11 at
980 Hz pins 5&^
490Hz;
pinMode(pinLED,OUTPUT);
analogWrite(pinLED,0);
delay(1000);
analogWrite(pinLED,50);
delay(1000);
analogWrite(pinLED,255);
delay(1000);
int redPin=9;
int bright=127;
void setup(){
pinMode(pinLED,OUTPUT);
pinMode(redPin,OUTPUT)
}
void loop(){
analogWrite(redPin,bright);
}
void loop(){
analogWrite(pinLED,0);
delay(1000);
analogWrite(pinLED,50);
delay(1000);
}
11/12/2026
digitalWrite(buzzer,Low);
delay(random(900,4901));
digitalWrite(redLed,LOW);
while (buttonPressed == 0){
digitalWrite(whiteLED1, HIGH);
digitalWrite(whiteLED2, HIGH);
if (digitalRead(button1) ==0) {
buttonPresses = 1;
digitalWrite(whiteLED2, LOW);
} else if (digitalRead(button2) == 0){
buttonPressed = 1;
digitalWrite(whiteLED1, LOW);
}
}
digitalWrite(buzzer, HIGH);
delay(500);
digitalWrite(buzzer, HIGH);
delay(1500);
digitalWrite(whiteLED1, LOW);
digitalWrite(whiteLED2, LOW);
buttonPresssed = 0;
}
https://www.youtube.com/watch?v=jvDCoyFLYGs
11/1/26
../
Tesis 2: Predicción del desgaste con Machine Learning - PUCP - Ingeniería Mecánica
https://www.youtube.com/watch?v=jSfTBpg1fZU
../