Arduino: A board with a microcontroller, typically an ATmega328.
PWM Pins (~): Indicated by ~
on the Arduino pins, capable of Pulse Width Modulation (PWM).
analogWrite()
, but still digital in nature.Analog Pins: Real analog input pins are available on the Arduino.
Serial.begin(9600);
: Initializes serial communication at 9600 baud rate.Serial.print();
: Prints data to the serial monitor without a newline.Serial.println();
: Prints data to the serial monitor with a newline.true
or 1
.false
or 0
.static int
for variables to persist their value across function calls instead of declaring global variables.digitalRead(pin)
: Reads the state (HIGH or LOW) of a digital pin.digitalWrite(pin, value)
: Sets a digital pin to HIGH or LOW.analogRead(pin)
: Reads the value from an analog pin (0 to 1023).analogWrite(pin, value)
: Outputs PWM signal (0 to 255) for controlling LED brightness or motor speed.
~
).analogWrite(0)
→ 0% duty cycleanalogWrite(64)
→ 25% duty cycleanalogWrite(127)
→ 50% duty cycleanalogWrite(191)
→ 75% duty cycleanalogWrite(255)
→ 100% duty cycle