KevinCasoco / waste-disposal-tracking-system

Waste Disposal Tracking System for District 3 of Caloocan City our capstone project.
https://wastedisposaltrackingsystem-2024.com/
1 stars 0 forks source link

Weight Sensor using arduino #39

Closed KevinCasoco closed 7 months ago

KevinCasoco commented 9 months ago

https://chat.openai.com/c/dde59da3-db56-4628-a737-3f64fb99131a

arduino ide

const int weightSensorPin = A0; // Analog pin connected to the weight sensor const int ledPin = 13; // Digital pin connected to an LED

void setup() { pinMode(ledPin, OUTPUT); Serial.begin(9600); }

void loop() { // Read the analog value from the weight sensor int sensorValue = analogRead(weightSensorPin);

// Map the sensor value to a range (adjust according to your sensor specifications) int mappedValue = map(sensorValue, 0, 1023, 0, 100);

// Display the raw and mapped values Serial.print("Sensor Value: "); Serial.print(sensorValue); Serial.print("\tMapped Value: "); Serial.println(mappedValue);

// Check if weight exceeds a certain threshold (adjust as needed) if (mappedValue > 50) { digitalWrite(ledPin, HIGH); // Turn on the LED } else { digitalWrite(ledPin, LOW); // Turn off the LED }

delay(1000); // Adjust delay based on your application's requirements }

jaytzy024 commented 9 months ago

Ncnc boss@KevinCasoco

KevinCasoco commented 7 months ago

https://youtu.be/nodSjsUoWVA?si=bHEa7T4_suohMpI8