Sutrpath
Sutrpath
3. Small-scale Automation
• Automated aquarium
• Precision thermal chamber
• Automated electronic test system
4. Performance Art
• Dynamic lighting control
• Dynamic sound control
• Audience responsive artwork
Microcontroller:
The heart of the Arduino Uno R3 is the ATmega328P, an 8-bit
AVR(developed by atmel organization) microcontroller with low power
consumption and high performance.
Input/Output Pins:
USB Interface:
Clock Speed:
Operates at a clock frequency of 16 MHz, providing sufficient speed for
most applications.
Memory:
Reset Button:
Includes a reset button to restart the program or hardware if needed.
Size:
Compact dimensions of 68.6 mm x 53.4 mm, making it portable and easy
to integrate into projects.
Digital I/O functions control the digital pins of the Arduino board. These
pins can either act as inputs (to read data) or outputs (to send data).
Common Functions:
pinMode(pin, mode):
Configures a specific pin as an INPUT, OUTPUT
Example: pinMode(13, OUTPUT);
digitalWrite(pin, value):
Sets a digital pin to HIGH (5V) or LOW (0V).
Example: digitalWrite(13, HIGH);
digitalRead(pin):
Reads the state of a digital pin, returning either HIGH or LOW.
Example: int buttonState = digitalRead(7);
Arduino has analog pins (e.g., A0–A5) for reading varying voltages and
writing simulated analog output using Pulse Width Modulation (PWM).
Common Functions:
analogRead(pin):
Reads the input voltage on an analog pin and returns a value
between 0 and 1023, corresponding to 0V–5V.
Example: int sensorValue = analogRead(A0);
analogWrite(pin, value):
Writes a PWM signal to a digital pin configured for PWM (e.g., pins
3, 5, 6, 9, 10, 11 on Uno). The value ranges from 0 to 255.
Example: analogWrite(9, 128);
3. Timer Functions
Timers are used for time-based tasks like delays, blinking LEDs, or
measuring time.
Common Functions:
delay(milliseconds):
Pauses the program for a specified number of milliseconds.
Example: delay(1000); // Pause for 1 second
millis():
Returns the number of milliseconds since the program started
running.
Example: unsigned long currentTime = millis();
micros():
Returns the number of microseconds since the program started.
Example: unsigned long timeMicros = micros();
delayMicroseconds(us):
Pauses the program for a specified number of microseconds.
Example: delayMicroseconds(500); // Pause for 0.5 ms
The shiftOut function is used to send data one bit at a time to devices like
shift registers or LED drivers. It works by toggling a data pin and a clock
pin in synchronization.
Parameters:
Parameters:
pin: The digital pin to read the pulse from.
value: The pulse level to detect (HIGH or LOW).
timeout (optional): The maximum time (in microseconds) to wait
for the pulse. If not provided, defaults to 1 second.
Parameters:
Example:
void setup() {
tone(8, 1000, 500); // Generate a 1 kHz tone for 500 ms
}
Note:
4. noTone(pin)
5. Communication Functions
6. Interrupt Functions
Common Functions:
Parameters:
1. digitalPinToInterrupt(pin):
Converts a digital pin number into an interrupt number .
2. ISR (Interrupt Service Routine):
A function (defined by the user) that will be executed when the
interrupt is triggered.
3. mode:
Defines the condition that triggers the interrupt:
o LOW: Trigger the interrupt when the pin is LOW.
o CHANGE: Trigger the interrupt when the pin changes state
(from HIGH to LOW or vice versa).
o RISING: Trigger the interrupt when the pin transitions from
LOW to HIGH.
o FALLING: Trigger the interrupt when the pin transitions from
HIGH to LOW.
detachInterrupt(digitalPinToInterrupt(pin)):
Disables the interrupt on a specific pin.
Example: detachInterrupt(digitalPinToInterrupt(2));
7. Math Functions
Common Functions:
Input value: 50
Input range: 0–100
Output range: 0–255
void loop() {
digitalWrite(13, HIGH); // Turn the LED ON
delay(1000); // Wait for 1 second (1000 milliseconds)
digitalWrite(13, LOW); // Turn the LED OFF
delay(1000); // Wait for 1 second
}