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.
This commit is contained in:
parent
f2753c3d1c
commit
903a1058e7
1 changed files with 27 additions and 6 deletions
|
@ -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);
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue