Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Sirisha R
Created September 2, 2024

Enhancing Bathroom Accessibility for Individuals

Enhancing Bathroom Accessibility for Individuals with Mobility Impairments through Adjustable Fixtures and Safety Enhancements

33
Enhancing Bathroom Accessibility for Individuals

Things used in this project

Story

Read more

Schematics

Image

Code

Arduino Code

Arduino
// Define pin numbers for the height adjustment buttons
const int upButtonPin = 2;
const int downButtonPin = 3;

// Define pin numbers for the motor control
const int motorUpPin = 4;
const int motorDownPin = 5;

// Variables to store the button states
int upButtonState = 0;
int downButtonState = 0;

void setup() {
  // Initialize the button pins as input
  pinMode(upButtonPin, INPUT);
  pinMode(downButtonPin, INPUT);
  
  // Initialize the motor control pins as output
  pinMode(motorUpPin, OUTPUT);
  pinMode(motorDownPin, OUTPUT);
  
  // Start with the motor off
  digitalWrite(motorUpPin, LOW);
  digitalWrite(motorDownPin, LOW);
}

void loop() {
  // Read the state of the up button
  upButtonState = digitalRead(upButtonPin);

  // Read the state of the down button
  downButtonState = digitalRead(downButtonPin);

  // If the up button is pressed, move the sink up
  if (upButtonState == HIGH) {
    digitalWrite(motorUpPin, HIGH);
    digitalWrite(motorDownPin, LOW);
  } 
  // If the down button is pressed, move the sink down
  else if (downButtonState == HIGH) {
    digitalWrite(motorUpPin, LOW);
    digitalWrite(motorDownPin, HIGH);
  } 
  // If neither button is pressed, stop the motor
  else {
    digitalWrite(motorUpPin, LOW);
    digitalWrite(motorDownPin, LOW);
  }
}

Credits

Sirisha R
1 project • 0 followers
Contact

Comments

Please log in or sign up to comment.