UDAYVEER YDV EDW
UDAYVEER YDV EDW
UDAYVEER YDV EDW
ASSIGNMENT = 1
Name – UDAYVEER
ROLL NO- 2023UEI2842
1- WHAT IS ANALOG INPUT ?
• Reading Sensors
• (e.g., LM35, TMP36)
• Light sensors (e.g., LDR - Light Dependent Resistor)
• Potentiometers (variable resistors for adjusting values)
• Measuring Voltage
• Can be used to monitor battery levels or external
voltage sources.
• Interfacing with Analog Devices
• Some microphones, pressure sensors, and
other analog devices can be connected.
6- Analog Input Pins in Arduino
Formula :
8- Pulse Width Modulation (PWM)
Operation
Overview of Interrupts
Interrupts are signals that temporarily halt the main
program execution to allow a specific routine
(Interrupt Service Routine or ISR) to run. This
mechanism is crucial for real-time applications
where timely responses to events are necessary.
For example, an interrupt can be triggered by
hardware events such as timers or external signals
Using Interrupts in PWM Applications:
void setup() {
pinMode(2, INPUT); // External PWM input
pinMode(9, OUTPUT); // PWM output pin
attachInterrupt(digitalPinToInterrupt(2),
togglePWM, RISING); // Trigger on rising edge
}
void loop() {
analogWrite(9, pwmState ? 255 : 0); // Write PWM
signal based on state
}
void togglePWM() {
pwmState = !pwmState; // Toggle state on
interrupt
}
Conclusion