🚀
ArkyEdu GLOSAR TIC
RO Practice Lab
Robotics & Arduino IoT Grades 7–8 RO Term: Pini Digitali, Analogici (ADC) și PWM (~) pe Arduino

Digital, Analog (ADC) & PWM (~) Arduino Pins

💬 Share on WhatsApp
📌 Quick Definition (Answer-First)

Digital pins (0–13) read or output strictly two states: HIGH (5V) or LOW (0V). Analog input pins (A0–A5) measure continuous sensor voltages from 0 to 1023, while PWM (~) pins output 0–255 duty cycles to dim LEDs or control motor speed.

How It Works & Why It Matters

Digital pins handle pushbuttons and on/off relays; analogRead() samples light sensors, temperature probes, and gas sensors.

Pins marked with a tilde (~) on UNO (3, 5, 6, 9, 10, 11) support analogWrite(pin, 0..255) via rapid Pulse-Width Modulation.

💻 Pin I/O Functions & Value Ranges
digitalWrite(8, HIGH);       // 0 or 1
int btn = digitalRead(2);    // HIGH / LOW
int light = analogRead(A0);  // 0 .. 1023 (10-bit ADC)
analogWrite(9, 128);         // 0 .. 255 PWM on ~ pins

🏫 Classroom Example

Use map(analogRead(A0), 0, 1023, 0, 255) to turn a sensor reading smoothly into LED brightness.

⚖️ Digital Signal vs. Analog Signal

Digital signals jump cleanly between 0 and 1; analog signals vary smoothly across a continuous range.

⚠️ Common Mistake in Exams & Homework

Calling analogWrite() on a non-PWM pin like pin 4—it only turns completely on (>=128) or off (<128).

❓ Quick Questions & Answers

Which Arduino UNO pins support PWM output?
Digital pins 3, 5, 6, 9, 10, and 11 (marked with ~).

Related Glossary Terms

← Back to Full Glossary (A–Z)