From 903a1058e76fc7fc33b66981506f14b6e02675b3 Mon Sep 17 00:00:00 2001 From: Marcus Date: Sun, 7 Apr 2024 00:46:27 +0200 Subject: [PATCH] Arduino Code, switched Pins for LED and Pump, added Serial output, heavily WIP. Now the Hardware is finished so far, and the first perfboard prototype is working https://social.la10cy.net/@DeltaLima/112226694609763485 Now I can focus on the software stuff. --- Arduino/CanGrow/CanGrow.ino | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/Arduino/CanGrow/CanGrow.ino b/Arduino/CanGrow/CanGrow.ino index 75eb834..81a8969 100644 --- a/Arduino/CanGrow/CanGrow.ino +++ b/Arduino/CanGrow/CanGrow.ino @@ -7,8 +7,8 @@ * D0 - MOSFET Fan * D1, D2 - I2C * D3 - DHT11 - * D5 - MOSFET Grow LED, PWM - * D6 - MOSFET Pump + * D5 - MOSFET Pump + * D6 - MOSFET Grow LED, PWM * D7 - waterlevel (set HIGH to read value) * D8 - analog soil moisture (set HIGH to read value) * A0 - analog input for soil moisture and waterlevel readings @@ -28,8 +28,8 @@ uint8_t PINfan = D0; // If D3 is pulled to LOW, boot fails uint8_t PINdht = D3; // D4 is HIGH at boot, boot fail if pulled to LOW -uint8_t PINled = D5; // -uint8_t PINpump = D6; +uint8_t PINpump = D5; +uint8_t PINled = D6; // uint8_t PINwaterlevel = D7; uint8_t PINsoilmoisture = D8; uint8_t PINanalog = A0; @@ -197,8 +197,12 @@ void setup() { Wire.begin(); // initialise Serial output Serial.begin(115200); + //Serial.println("Test123"); + + // reset chirp writeI2CRegister8bit(0x20, 6); //reset + // initialise I2C display display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // Address 0x3C for 128x32 @@ -223,6 +227,7 @@ void setup() { } void loop() { + // set display cursor to top left display.setCursor(0,0); // display text @@ -231,22 +236,38 @@ void loop() { display.print(", "); display.println(getTemperature(1)); + Serial.print("I2C: "); + Serial.print(getSoilmoisture()); + Serial.print(", "); + Serial.println(getTemperature(1)); + display.print("DHT11: "); display.print(getTemperature(0)); display.print(", "); display.println(getHumidity()); - display.display(); + + Serial.print("DHT11: "); + Serial.print(getTemperature(0)); + Serial.print(", "); + Serial.println(getHumidity()); display.print("Water Status: "); display.println(getWaterlevel()); + Serial.print("Water Status: "); + Serial.println(getWaterlevel()); +/* display.print("light: "); display.println(getLightchirp()); // print everything on the display + */ display.display(); - delay(800); + Serial.println("Test"); + delay(1000); + + }