TimothyWei Yuan NeoKieran Jeraldethan
Published

Sustainable Technology for Urban Farming

A way to keep your plants hydrated when overseas

BeginnerFull instructions provided171
Sustainable Technology for Urban Farming

Things used in this project

Story

Read more

Schematics

Flowchart

Block Diagram

Block code 1st part

Block code 2nd part

Code

Project Code

Python
from m5stack import *
from m5ui import *
from uiflow import *
import time
import unit

setScreenColor(0x222222)
env2_0 = unit.get(unit.ENV2, unit.PORTA)
earth_0 = unit.get(unit.EARTH, unit.PORTB)






label4 = M5TextBox(146, 175, "Text", lcd.FONT_Default, 0xFFFFFF, rotate=0)
label0 = M5TextBox(74, 36, "Moisture:", lcd.FONT_Default, 0xFFFFFF, rotate=0)
label1 = M5TextBox(74, 123, "Temperature:", lcd.FONT_Default, 0xFFFFFF, rotate=0)
label2 = M5TextBox(208, 36, "Text", lcd.FONT_Default, 0xFFFFFF, rotate=0)
label3 = M5TextBox(207, 123, "Text", lcd.FONT_Default, 0xFFFFFF, rotate=0)


while True:
  label2.setText(str(earth_0.analogValue))
  label3.setText(str(env2_0.temperature))
  if (earth_0.analogValue) < 100 and (env2_0.temperature) > 30:
    label4.setText('Watering...')
    wait_ms(1)
    for count in range(2):
      speaker.tone(1200, 200)
      rgb.setColorAll(0xff0000)
      wait_ms(1)
      rgb.setColorAll(0x000000)
      wait_ms(1)
      rgb.setColorAll(0xff0000)
  elif (earth_0.analogValue) > 100 and (env2_0.temperature) > 30:
    for count2 in range(2):
      rgb.setColorAll(0x33ff33)
      wait_ms(1)
      rgb.setColorAll(0x000000)
      wait_ms(1)
      rgb.setColorAll(0x33ff33)
  elif (earth_0.analogValue) < 100 and (env2_0.temperature) < 30:
    label4.setText('Watering...')
    wait_ms(1)
    for count3 in range(2):
      speaker.tone(1200, 200)
      rgb.setColorAll(0xff0000)
      wait_ms(1)
      rgb.setColorAll(0x000000)
      wait_ms(1)
      rgb.setColorAll(0xff0000)
  elif (earth_0.analogValue) > 100 and (env2_0.temperature) < 30:
    for count4 in range(2):
      rgb.setColorAll(0x33ff33)
      wait_ms(1)
      rgb.setColorAll(0x000000)
      wait_ms(1)
      rgb.setColorAll(0x33ff33)
  wait_ms(2)

Credits

Timothy

Timothy

1 project • 0 followers
Wei Yuan Neo

Wei Yuan Neo

1 project • 0 followers
Kieran Jerald

Kieran Jerald

1 project • 0 followers
ethan

ethan

1 project • 0 followers

Comments