playing with arduino code
This commit is contained in:
parent
35d08e1ce8
commit
3d923803f0
1 changed files with 60 additions and 15 deletions
|
@ -266,51 +266,81 @@ void setup() {
|
|||
}
|
||||
|
||||
void loop() {
|
||||
int valSoilmoisture0 = getSoilmoisture(0);
|
||||
int valSoilmoisture1 = getSoilmoisture(1);
|
||||
|
||||
int valTemperature0 = getTemperature(0);
|
||||
int valTemperature1 = getTemperature(1);
|
||||
|
||||
float valHumidity = getHumidity();
|
||||
|
||||
int valWaterlevel = getWaterlevel();
|
||||
|
||||
|
||||
// set display cursor to top left
|
||||
display.setCursor(0,0);
|
||||
// display text
|
||||
display.print("I2C: ");
|
||||
display.print(getSoilmoisture(1));
|
||||
display.print(valSoilmoisture1);
|
||||
display.print(", ");
|
||||
display.println(getTemperature(1));
|
||||
display.println(valTemperature1);
|
||||
|
||||
Serial.print("I2C: ");
|
||||
Serial.print(getSoilmoisture(1));
|
||||
Serial.print(valSoilmoisture1);
|
||||
Serial.print(", ");
|
||||
Serial.println(getTemperature(1));
|
||||
Serial.println(valTemperature1);
|
||||
|
||||
|
||||
display.print("DHT11: ");
|
||||
display.print(getTemperature(0));
|
||||
display.print(valTemperature0);
|
||||
display.print(", ");
|
||||
display.println(getHumidity());
|
||||
display.println(valHumidity);
|
||||
|
||||
Serial.print("DHT11: ");
|
||||
Serial.print(getTemperature(0));
|
||||
Serial.print(valTemperature0);
|
||||
Serial.print(", ");
|
||||
Serial.println(getHumidity());
|
||||
Serial.println(valHumidity);
|
||||
|
||||
|
||||
display.print("Water Status: ");
|
||||
display.println(getWaterlevel());
|
||||
display.println(valWaterlevel);
|
||||
|
||||
Serial.print("Water Status: ");
|
||||
Serial.println(getWaterlevel());
|
||||
Serial.println(valWaterlevel);
|
||||
|
||||
display.print("ASM: ");
|
||||
display.print(getSoilmoisture(0));
|
||||
display.print(valSoilmoisture0);
|
||||
display.println(", ");
|
||||
|
||||
Serial.print("ASM: ");
|
||||
Serial.println(getSoilmoisture(0));
|
||||
Serial.println(valSoilmoisture0);
|
||||
|
||||
// print everything on the display
|
||||
display.display();
|
||||
|
||||
Serial.println("Test");
|
||||
|
||||
if(D6status == true) {
|
||||
switch(valWaterlevel) {
|
||||
|
||||
case 0:
|
||||
digitalWrite(PINled, HIGH);
|
||||
digitalWrite(PINpump, LOW);
|
||||
digitalWrite(PINfan, LOW);
|
||||
break;
|
||||
case 1:
|
||||
digitalWrite(PINled, LOW);
|
||||
digitalWrite(PINpump, HIGH);
|
||||
digitalWrite(PINfan, LOW);
|
||||
break;
|
||||
case 2:
|
||||
digitalWrite(PINled, LOW);
|
||||
digitalWrite(PINpump, LOW);
|
||||
digitalWrite(PINfan, HIGH);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
/* if(D6status == true) {
|
||||
digitalWrite(PINled, LOW);
|
||||
digitalWrite(PINpump, LOW);
|
||||
digitalWrite(PINfan, LOW);
|
||||
|
@ -323,7 +353,22 @@ void loop() {
|
|||
D6status = true;
|
||||
Serial.println("D6 is ON now");
|
||||
}
|
||||
delay(100);
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
for(int dutyCycle = 0; dutyCycle < 255; dutyCycle++){
|
||||
// changing the LED brightness with PWM
|
||||
analogWrite(D4, dutyCycle);
|
||||
delay(1);
|
||||
}
|
||||
|
||||
// decrease the LED brightness
|
||||
for(int dutyCycle = 255; dutyCycle > 0; dutyCycle--){
|
||||
// changing the LED brightness with PWM
|
||||
analogWrite(D4, dutyCycle);
|
||||
delay(1);
|
||||
}
|
||||
*/
|
||||
|
||||
delay(800);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue