arduino file
arduino file
2. Blink an LED:
- Connect an LED’s anode to digital pin 13 and cathode to ground via a 220Ω
resistor.
- Write and upload this sketch to blink the LED:
```cpp
void setup() {
pinMode(13, OUTPUT);
}
void loop() {
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}
- Observe the LED blinking every second.
int buttonState = 0;
void setup() {
pinMode(13, OUTPUT);
pinMode(2, INPUT_PULLUP);
}
void loop() {
buttonState = digitalRead(2);
if (buttonState == LOW) {
digitalWrite(13, HIGH);
} else {
digitalWrite(13, LOW);
}
}
- Upload and test by pressing the button.
int buttonState = 0;
void setup() {
pinMode(13, OUTPUT);
pinMode(2, INPUT_PULLUP);
Serial.begin(9600);
}
void loop() {
buttonState = digitalRead(2);
if (buttonState == LOW) {
digitalWrite(13, HIGH);
Serial.println("Button Pressed");
} else {
digitalWrite(13, LOW);
Serial.println("Button Released");
}
delay(100);
}
- Upload, open the Serial Monitor (Ctrl+Shift+M), and set the baud rate to 9600.
Observation Table:
Result:
This experiment introduced the Arduino platform, IDE setup, and basic sketch
structure. It demonstrated digital output (controlling an LED), digital input (reading a
button), and serial communication (displaying messages), laying the foundation for
Arduino programming.
void setup() {
Serial.begin(9600);
}
void loop() {
int sensorValue = analogRead(A0);
Serial.println(sensorValue);
delay(100);
}
- Open the Serial Monitor and turn the potentiometer to see varying values.
void setup() {
pinMode(9, OUTPUT);
Serial.begin(9600);
}
void loop() {
int sensorValue = analogRead(A0);
int brightness = map(sensorValue, 0, 1023, 0, 255);
analogWrite(9, brightness);
Serial.print("Analog Value: ");
Serial.print(sensorValue);
Serial.print(" | Brightness: ");
Serial.println(brightness);
delay(100);
}
- Upload and observe the LED’s brightness changing with the potentiometer.
Observation Table:
Potentiometer Position Analog Brightness LED Brightness
Value
Minimum 0 0 Off
Middle ~512 ~128 Medium
Maximum 1023 255 Full
Result:
This experiment demonstrated measuring analog voltage with analogRead() and
generating analog-like output with PWM using analogWrite(). The potentiometer
controlled LED brightness, reinforcing serial communication skills.
Result:
This experiment taught non-blocking timing with millis(), efficient event handling with
interrupts, and measuring time intervals, enhancing responsiveness in Arduino
projects.
Aim:
To determine the unknown capacitance using De Sauty’s Bridge Method.
Apparatus Required:
A.C. source
Headphones
Two capacitors (one known , one unknown )
Two resistors and (one variable)
De Sauty’s bridge setup
Connecting wires
Circuit Diagram:
(Leave space to draw the De Sauty’s bridge circuit diagram. If you want a labelled diagram, I can provide
it.)
Theory:
De Sauty's Bridge is a modified Wheatstone bridge used to compare two capacitances. The bridge consists
of two capacitors and two resistors in a bridge network. A headphone is connected between the midpoints of
the capacitor and resistor arms. An A.C. source is applied across the opposite corners.
At balance (no sound in the headphone), the ratio of capacitances equals the ratio of resistances:
Procedure:
1. Connect the circuit as per the diagram.
2. Use the known capacitor and connect the unknown capacitor in the respective arms.
3. Connect resistors (variable) and in the other two arms.
4. Apply an A.C. source between terminals A and C.
5. Connect the headphone between points B and D.
6. Vary until no sound is heard in the headphones (bridge balanced).
7. Note the values of , , and .
8. Calculate the unknown capacitance using the balance condition.
Observations:
Known Capacitance (μF) (Ω) (Ω) Calculated (μF)
Calculation:
C_2 = C_1 \cdot \frac{R_1}{R_2}
Result:
The unknown capacitance is found to be ______ μF.
Precautions:
1. Ensure all connections are tight and correct.
2. Use pure sinusoidal A.C. supply.
3. Adjust the resistors slowly for accurate balance point.
4. Use ideal capacitors if possible.
Let me know if you need the circuit diagram or a Viva Questions section too.