Skip to content
Snippets Groups Projects
Commit 2fd3027b authored by Siddhi Bodhe's avatar Siddhi Bodhe
Browse files

weekupdates

parent 9c51d695
No related branches found
No related tags found
No related merge requests found
Pipeline #468144 passed
......@@ -270,6 +270,27 @@ Now, its time for testing. Firstly, I tested all the devices separately with PCB
<b>Code:-</b><br>
<code>
const int buzzerPin = 5; // Replace with your desired buzzer pin<br>
<br>
void setup() {<br>
pinMode(buzzerPin, OUTPUT); // Set buzzer pin as output<br>
}<br>
<br>
void loop() {<br>
// Turn buzzer on<br>
tone(buzzerPin, 1000); // Play a tone (optional, for audible indication)<br>
<br>
// Buzzer on time<br>
delay(1000); // Wait for 1 second (buzzer on)<br>
<br>
// Turn buzzer off<br>
noTone(buzzerPin);<br>
<br>
// Buzzer off time<br>
delay(2000); // Wait for 2 seconds (buzzer off)<br>
}<br>
<br>
......@@ -288,6 +309,21 @@ Now, its time for testing. Firstly, I tested all the devices separately with PCB
<b>Code:-</b><br>
<code>
#include <LiquidCrystal.h> // Include LiquidCrystal library<br>
<br>
const int lcdPins[4] = {32, 33, 25, 26}; // Replace with your LCD pin connections (RS, E, D4, D5)<br>
LiquidCrystal lcd(lcdPins[0], lcdPins[1], lcdPins[2], lcdPins[3]);<br>
<br>
void setup() {<br>
lcd.begin(16, 2); // Set LCD dimensions (columns, rows)<br>
lcd.clear(); // Clear LCD display<br>
lcd.print("SIDDHI"); // Print "SIDDHI" on the LCD<br>
}<br>
<br>
void loop() {<br>
// No additional code needed here for displaying text, it's done in setup<br>
}<br>
<br>
......@@ -306,6 +342,35 @@ Now, its time for testing. Firstly, I tested all the devices separately with PCB
<b>Code:-</b><br>
<code>
const int redPin = 25;<br>
const int greenPin = 26;<br>
const int bluePin = 32;<br>
<br>
void setup() {<br>
pinMode(redPin, OUTPUT);<br>
pinMode(greenPin, OUTPUT);<br>
pinMode(bluePin, OUTPUT);<br>
}<br>
<br>
void loop() {<br>
// Set all LEDs off initially<br>
digitalWrite(redPin, LOW);<br>
digitalWrite(greenPin, LOW);<br>
digitalWrite(bluePin, LOW);<br>
<br>
// Display different colors by turning on/off individual LEDs<br>
digitalWrite(redPin, HIGH); // Red<br>
delay(1000);<br>
<br>
digitalWrite(redPin, LOW);<br>
digitalWrite(greenPin, HIGH); // Green<br>
delay(1000);<br>
<br>
digitalWrite(greenPin, LOW);<br>
digitalWrite(bluePin, HIGH); // Blue<br>
delay(1000);<br>
}<br>
......
......@@ -263,7 +263,26 @@ Now, its time for testing. Firstly, I tested all the devices separately with PCB
<b>Code:-</b><br>
<code>
const int sensorPin = 34; // Analog input pin connected to MQ-135<br>
const int heaterPin = 25; // Digital output pin connected to MQ-135 heater<br>
<br>
void setup() {<br>
Serial.begin(115200); // Initialize serial communication for printing data<br>
pinMode(heaterPin, OUTPUT); // Set heater pin as output<br>
}<br>
<br>
void loop() {<br>
digitalWrite(heaterPin, HIGH); // Turn on heater (adjust based on sensor datasheet)<br>
delay(1000); // Wait for heater to stabilize (adjust based on sensor datasheet)<br>
<br>
int sensorValue = analogRead(sensorPin);<br>
Serial.print("Sensor Value: ");<br>
Serial.println(sensorValue);<br>
<br>
digitalWrite(heaterPin, LOW); // Turn off heater (adjust based on sensor datasheet)<br>
delay(5000); // Wait before next reading<br>
}<br>
......@@ -281,7 +300,23 @@ Now, its time for testing. Firstly, I tested all the devices separately with PCB
<b>Code:-</b><br>
<code>
const int sensorPin = 34; // Analog input pin connected to pressure sensor<br>
<br>
void setup() {<br>
Serial.begin(115200); // Initialize serial communication for printing data<br>
}<br>
<br>
void loop() {<br>
int sensorValue = analogRead(sensorPin);<br>
float voltage = sensorValue * (3.3 / 1023.0); // Convert raw value to voltage (assuming 3.3V reference)<br>
// Apply calibration factor based on your sensor datasheet to convert voltage to pressure<br>
float pressure = voltage * calibration_factor; // Replace with your calibration calculation<br>
Serial.print("Pressure: ");<br>
Serial.print(pressure);<br>
Serial.println(" (your pressure unit)");<br>
delay(1000); // Wait 1 second before next reading<br>
}<br>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment