Arduino code

Zengzi Li and Cheng Pang

#include <Servo.h>  // Include the Servo library


// Define the pin where the photoresistor is connected

const int photoResistorPin = A0;


// Define the pin where the servo is connected

const int servoPin = 12;


// Create a Servo object

Servo myServo;


void setup() {

  // Start the Serial Monitor at 9600 baud

  Serial.begin(9600);

  

  // Attach the servo to pin 12

  myServo.attach(servoPin);

  

  // Move the servo to its initial position (0 degrees)

  myServo.write(0);

  delay(1000); // Wait 1 second to ensure the servo is at 0 degrees

}


void loop() {

  // Read the value from the photoresistor

  int sensorValue = analogRead(photoResistorPin);

  

  // Print the sensor value to the Serial Monitor

  Serial.print("Photoresistor Value: ");

  Serial.println(sensorValue);

  

  // Check if the sensor value is above the threshold

  if (sensorValue > 22) {

    // Rotate the servo to 180 degrees

    myServo.write(7200);

    delay(1000);  // Wait for 1 second

    

    // Rotate the servo back to 0 degrees

    myServo.write(0);

    delay(1000);  // Wait for 1 second before checking again

  }

  

  // A small delay before checking again

  delay(100);

}

ChatGPT feedback session

oliver choi and Charles Juhas

https://chatgpt.com/share/678fc9ab-bd40-8013-8d34-027bcbe893f5

Prototype

Yizhe Ying and Jack LaRovere Abrams
IMG_1397.jpg

Final prototype

Final iteration

Yizhe Ying and Jack LaRovere Abrams

Prototupe

Rubric

Charlie Danziger
StoryExport.MOV

Video of combined house & electronics attached

Button-Activated Sprinkler.mov

We spent the weekend working on our project.

Progress Video and picture (attached)

Day 3 progress

Shiran Guo and Yichao Xie

Today, we find solutions to lifting the roof: 1. to use an elevator model. 2. to use a servo motor

Charles figured out the servo motor code, and I made an elevator mechanics proof.

second code day 2

Yichao Xie and Shiran Guo
// Define the pin connected to the pressure sensor (FSR)const int fsrPin = A0;  // FSR sensor connected to analog pin A0
// Define the pin for the LED (pin 13 in this case)const int ledPin = 13;  // LED connected to pin 13
// Define the threshold value to detect pressureint threshold = 300;  // Adjust this value based on your sensor's response
void setup() {  // Start the serial communication  Serial.begin(9600);
  // Wait for the serial port to connect  while (!Serial) {    ; // Wait for the serial port to connect. Needed for native USB port boards.  }
  // Set the LED pin as an output  pinMode(ledPin, OUTPUT);
  // Print a startup message  Serial.println("Pressure Sensor with LED Example Initialized");}
void loop() {  // Read the analog value from the sensor (0 to 1023)  int sensorValue = analogRead(fsrPin);
  // Print the sensor value to the serial monitor (optional)  Serial.print("FSR Value: ");  Serial.println(sensorValue);
  // Check if the sensor value exceeds the threshold  if (sensorValue > threshold) {    Serial.println("Pressure Sensed");  // Print when pressure is detected
    // Turn on the LED when pressure is sensed    digitalWrite(ledPin, HIGH);  } else {    // Turn off the LED when no pressure is sensed    digitalWrite(ledPin, LOW);  }
  // Add a small delay to make the serial output readable  delay(500);  // 500ms delay}