Drei_Senpai
Enthusiast
- Joined
- Nov 20, 2022
- Posts
- 137
- Reaction
- 31
- Points
- 49
Pa help code for our capstone is Which automatic Laundry Retriever
1. The purposed is that it automatically retrieved when its raining and back when it's not ( we used rain sensor)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.
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: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
// 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);
}
}
- The purposed is that it automatically retrieved when its raining and back when it's not ( we used rain sensor)anong gagawin