What's new

C & C++ Pa help code for our capstone is Which automatic Laundry Retriever

Drei_Senpai

Enthusiast
Joined
Nov 20, 2022
Posts
137
Reaction
31
Points
49
Pa help code for our capstone is Which automatic Laundry Retriever
 
Sure, I'd be happy to help you with the code for your capstone project, the Automatic Laundry Retriever. Can you provide me with more specific details about what you need help with? For example, what programming language are you using, what sensors and hardware components are you working with, and what specific tasks do you need your laundry retriever to perform? The more information you can provide, the better I can assist you.
 
Sure, I'd be happy to help you with the code for your capstone project, the Automatic Laundry Retriever. Can you provide me with more specific details about what you need help with? For example, what programming language are you using, what sensors and hardware components are you working with, and what specific tasks do you need your laundry retriever to perform? The more information you can provide, the better I can assist you.
1. The purposed is that it automatically retrieved when its raining and back when it's not ( we used rain sensor)

2. The motor we used is one 12v Power Window Motor that connected to a h-bridge
3. .It retrieves when it's raining and return when the rain stop vice-versa
 
1. The purposed is that it automatically retrieved when its raining and back when it's not ( we used rain sensor)

2. The motor we used is one 12v Power Window Motor that connected to a h-bridge
3. .It retrieves when it's raining and return when the rain stop vice-versa
Great, I understand the requirements of your capstone project. Here's a sample code that will help you get started with the Automatic Laundry Retriever:

Code:
// Define the pins connected to the H-bridge motor driver
int motorPin1 = 9;
int motorPin2 = 10;
int enablePin = 11;

// Define the rain sensor input pin
int rainSensorPin = A0;

// Define variables to store the sensor values
int rainSensorValue = 0;
int threshold = 500;

void setup() {
  // Set the motor control pins as outputs
  pinMode(motorPin1, OUTPUT);
  pinMode(motorPin2, OUTPUT);
  pinMode(enablePin, OUTPUT);

  // Set the rain sensor pin as input
  pinMode(rainSensorPin, INPUT);

  // Set the initial motor direction to forward
  digitalWrite(motorPin1, HIGH);
  digitalWrite(motorPin2, LOW);

  // Set the initial motor speed to 0
  analogWrite(enablePin, 0);
}

void loop() {
  // Read the rain sensor input value
  rainSensorValue = analogRead(rainSensorPin);

  // Determine if it is raining or not
  if (rainSensorValue < threshold) {
    // It is raining, so retrieve the laundry
    digitalWrite(motorPin1, LOW);
    digitalWrite(motorPin2, HIGH);
    analogWrite(enablePin, 255);
  } else {
    // It is not raining, so return the laundry
    digitalWrite(motorPin1, HIGH);
    digitalWrite(motorPin2, LOW);
    analogWrite(enablePin, 255);
  }
}

This code uses an H-bridge motor driver to control the direction and speed of the 12V power window motor. The rain sensor is connected to an analog input pin, and the code reads the sensor value to determine if it is raining or not. If it is raining, the motor is set to retrieve the laundry, and if it is not raining, the motor is set to return the laundry.

Please note that this is just a sample code to give you an idea of how to get started. You may need to modify it to suit your specific requirements and hardware components.
 
anong gagawin
- The purposed is that it automatically retrieved when its raining and back when it's not ( we used rain sensor)

  • The motor we used is one 12v Power Window Motor that connected to a h-bridge
  • It retrieves when it's raining and return when the rain stop vice-versa

ito po lods.. Wala akong alam sa programming
 
pwede ka gumamit siguro ng humidity sensor or floater sensor. yung humidity sensor madedetect kung umuulan depende sa humidity. yung floater sensor mag titrigger kapag makalagay sya sa isang baso kunwari na mag kakatubig pag umulan tapos dapat may certain drainage sya na ilalabas din yung tubig kapag nawala na yung tubig sa baso na galing sa ulan, mag ttrigger ulit yung floater switch. kunin mo lang yung value based dun sa value na nilalabas ng sensor at ng switch kung ano man ang gusto mo gamitin jan. tapos sa arduino or raspberry pi pwede mo yang gawin. dun naman sa takbo ng motor mo, depende kung anong reading ng sensor or nung floater switch mo.
 
Last edited:
try mo to ts using rain sensor

#define sensorPower 7
#define sensorPin 8

void setup() {
pinMode(sensorPower, OUTPUT);

// Initially keep the sensor OFF
digitalWrite(sensorPower, LOW);

Serial.begin(9600);
}

void loop() {
//get the reading from the function below and print it
int val = readSensor();
Serial.print("Digital Output: ");
Serial.println(val);

// Determine status of rain
if (val) {
Serial.println("Status: Clear");
} else {
Serial.println("Status: It's raining");
}

delay(1000); // Take a reading every second
Serial.println();
}

// This function returns the sensor output
int readSensor() {
digitalWrite(sensorPower, HIGH); // Turn the sensor ON
delay(10); // Allow power to settle
int val = digitalRead(sensorPin); // Read the sensor output
digitalWrite(sensorPower, LOW); // Turn the sensor OFF
return val; // Return the value
}

hanapin mo to:


1682758676239.png
 

Attachments

Last edited:
Back
Top