day4 journal

Yichao Xie and Shiran Guo

cant use cardboard bc it's burning in the laser cutter. We have to switch to wood




#include <Servo.h>  // Include the Servo library
// 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 servo motorconst int servoPin = 9;  // Servo motor connected to pin 9
// Define the threshold value to detect pressure (lowered for increased sensitivity)int threshold = 50;  // Adjusted threshold to 100 for higher sensitivity
// Create a Servo objectServo myServo;
// Variable to track pressure statebool isPressureApplied = false;  // Track if pressure is currently applied
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.  }
  // Attach the servo to pin 9  myServo.attach(servoPin);
  // Initialize the servo to its resting position (0 degrees)  myServo.write(0);  // Set servo to 0 degrees at the start
  // Print a startup message  Serial.println("Pressure Sensor with Servo 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 (pressure detected)  if (sensorValue > threshold) {    if (!isPressureApplied) {      // Pressure applied, move the servo to 0 degrees      Serial.println("Pressure Detected");      myServo.write(0);  // Move servo to 0 degrees when pressure is applied      isPressureApplied = true;  // Mark that pressure is applied    }  } else {    // Pressure released (sensor value below threshold)    if (isPressureApplied) {      Serial.println("Pressure Released");      myServo.write(70);  // Move servo to 70 degrees when pressure is released      isPressureApplied = false;  // Reset the 3pressure state    }  }
  // Minimize delay (set to 50ms for faster response)  delay(50);  // Reduced delay to 50ms for even faster response}


improved code

Mid-Review Presentation

Shiran Guo and Yichao Xie

3rd day code

Yichao Xie and Shiran Guo
#include <Servo.h>  // Include the Servo library
// 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 servo motor (pin 9 is a better option than pin 13)const int servoPin = 9;  // Servo motor connected to pin 9
// Define the threshold value to detect pressureint threshold = 300;  // Adjust this value based on your sensor's response
// Create a Servo objectServo myServo;
bool pressureDetected = false;  // Track if pressure is currently detectedbool pressureReleased = false;  // Track if pressure has been released
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.  }
  // Attach the servo to pin 9  myServo.attach(servoPin);
  // Initialize the servo to its resting position (0 degrees)  myServo.write(0);  // Set servo to 0 degrees at the start
  // Print a startup message  Serial.println("Pressure Sensor with Servo 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 (pressure detected)  if (sensorValue > threshold) {    if (!pressureDetected) {      // Pressure detected, but we don't move the servo      Serial.println("Pressure Detected");      pressureDetected = true;  // Mark that pressure is detected    }  } else {    // Pressure released (sensor value below threshold)    if (pressureDetected && !pressureReleased) {      Serial.println("Pressure Released");      myServo.write(90);  // Move servo to 90 degrees when pressure is released      pressureReleased = true;  // Mark that pressure has been released    }  }
  // Reset the state when pressure is detected again to return servo to 0 degrees  if (sensorValue > threshold && pressureReleased) {    myServo.write(0);  // Move servo back to 0 degrees when pressure is applied again    pressureDetected = false;  // Mark that pressure is no longer detected    pressureReleased = false;  // Reset release flag  }
  // Add a small delay to make the serial output readable  delay(500);  // 500ms delay}

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}

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 threshold value to detect pressureint threshold = 500;  // Adjust this value based on your sensor's response
void setup() {  // Start the serial communication  Serial.begin(9600);
  // Wait for the serial monitor to be ready  while (!Serial) {    ; // Wait for the serial port to connect. Needed for native USB port boards.  }
  // Print a startup message  Serial.println("Pressure Sensor 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  }
  // Add a small delay to make the serial output readable  delay(500);  // 500ms delay}

Document day1

Yichao Xie and Shiran Guo

Today, we finalized our idea and decided how we are going to make our special roof. After receiving advice from Ms. M and combining both of the roof ideas we had before, we are going to make a self-repairable roof where one piece falls off; it will be a second piece automatically delivered to fill the hole.

Shark Tank Project

Shiran Guo and Yichao Xie

Shark Tank Project Ideas Architecture

Gary and Charles

Ideas

Shiran Guo and Yichao Xie