Day 6 progress

Shiran Guo and Yichao Xie

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


// Define the pin connected to the photoresistor

const int photoPin = A0;  // Photoresistor (Adafruit 161) connected to analog pin A0


// Define the pin for the servo motor

const int servoPin = 9;   // Servo motor connected to pin 9


// Define the threshold value to detect light

// Adjust this value based on the specific lighting conditions

int lightThreshold = 50;  // Example threshold


// Create a Servo object

Servo myServo;


// Variable to track light detection state

bool isLightDetected = false;  // Track if light level is currently above threshold


void setup() {

  // Start serial communication

  Serial.begin(9600);

  while (!Serial) {

    ; // Wait for the serial port to connect (necessary 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);  // Start at 0 degrees


  // Print a startup message

  Serial.println("Photoresistor (Adafruit 161) with Servo Example Initialized");

}


void loop() {

  // Read the analog value from the photoresistor (range 0 to 1023)

  int sensorValue = analogRead(photoPin);


  // Print the sensor value to the serial monitor

  Serial.print("Photoresistor Value: ");

  Serial.println(sensorValue);


  // Check if the sensor value exceeds the threshold (light detected)

  if (sensorValue > lightThreshold) {

    if (!isLightDetected) {

      // Light newly detected, move the servo to 0 degrees

      Serial.println("Light Detected");

      myServo.write(0);  // Move servo to 0 degrees

      isLightDetected = true; // Mark that light is detected

    }

  } else {

    // Light is below threshold

    if (isLightDetected) {

      Serial.println("Light Below Threshold");

      myServo.write(70);  // Move servo to 70 degrees

      isLightDetected = false; // Reset the detection state

    }

  }


  // Longer delay to observe changes more clearly (1 second)

  delay(1000);

}

prototype gif w/ photo resisstor

Yichao Xie and Shiran Guo

lasercut 2 progress

Mason Clish and 2 OthersEscher Briere
Matthew Oh
lasercut 2.3dm

not done

Today, we fixed the automation system. We altered the code by utilizing the millis function instead of delay so that the loop is not broken. Therefore, the button now successfully activates and deactivates the automatic watering system.

In addition, we made a container for our electronics so they do not get wet. Now, we will think back to biomimicry and design a new house that better mimics the Giant Sequoia tree.

Chat GPT conversation (Code)

Zengzi Li and Cheng Pang

https://chatgpt.com/share/679908ab-d468-800d-a0ad-865217583f7a

Code file

Zengzi Li and Cheng Pang
biomimicryproject.ino

Remember to download TSL 2561 plugin from arduino library when running

Circuit beginingss

Jack LaRovere Abrams and Yizhe Ying

Rhino File

Jack LaRovere Abrams and Yizhe Ying
ticiididi.3dm

a

Jan 28- Coding works

Cheng Pang and Zengzi Li
Movie on 1-28-25 at 11.28 AM.mov

1

Jan 28-finished coding!😄新年了

Cheng Pang and Zengzi Li
米大奇 2025-01-01 10.52.29.mp4