Question: we are going to make a ebb flow gardening system in which i am controlling the lighting system and i am using Microgreen salad Mix

we are going to make a ebb flow gardening system in which i am controlling the lighting system and i am using Microgreen salad Mix and Ruby stem Radish seeds so i need to make the changes in this code const int ledPin =13;
const int lightPin = A0;
const int relayPin =3;
const int ledPin2=12;
void setup(){
pinMode(ledPin, OUTPUT);
pinMode(lightPin, INPUT);
pinMode(relayPin, OUTPUT);
pinMode(ledPin2, OUTPUT);
Serial.begin(9600);
}
void loop(){
int lightValue = analogRead(lightPin);
Serial.println(lightValue);
// Control the light relay based on time intervals
unsigned long currentTime = millis();
unsigned long elapsedTime = currentTime %86400000;
unsigned long elapsedTimeInHours =(currentTime /1000)/3600;
if (elapsedTime <64800000){// Vegetative Stage: 18 hours on,6 hours off
if ((elapsedTimeInHours /2)%2==0){// If the current two-hour block is even
digitalWrite(relayPin, HIGH); // Turn on lights
analogWrite(ledPin,255); // Full brightness
analogWrite(ledPin2,255); // Turn on the new LED
} else {// If the current two-hour block is odd
digitalWrite(relayPin, LOW); // Turn off lights
analogWrite(ledPin,0); // LED off
analogWrite(ledPin2,0); // Turn off the new LED
}
} else if (elapsedTime <86400000){// Flowering Stage: 12 hours on,12 hours off
digitalWrite(relayPin,(elapsedTime <10800000|| elapsedTime >=54000000)? HIGH : LOW);
}
delay(1000);
} So i need like 12 hours on lights for the seeds and 10 hours off or you can change according to seeds
Apart from this i also need to build the circuit with the rasberry pi explain me step by step to build the circuit with reberry pi code to run the code for lighting system in ebb flow gardening system just for lighting system

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!