I want to turn on my LED connected to arduino board once it satisfies any condition provded in my python program.
These are the conditions:
Temperature < 28 , Humidity < 60 , Moisture> 179:
Observation= 'Temperature & Humidity is less.'
Temperature > 28 , Humidity < 60 , Moisture< 179:
Observation= 'Humidity & Moisture is less.'
Temperature < 28 , Humidity > 60 , Moisture < 179:
Observation = 'Temperature & Moisture is less.'
I want the LED to turn on when the output is : '<pre>Humidity & Moisture is less.
'
I have created a code to user input the data and predict the value:
x=int(input("Enter the tmp:"))
y=int(input("Enter the hum:"))
z=int(input("Enter the moist:"))
my_list =[x,y,z]
my_list
xc=[my_list]
print(xc)
y_pred = loaded_model.predict(xc)
print(y_pred)
Once we enter the inputs the ouput will get displayed through 'y pred' respective to the condition provided.
I want the led to turn on when y pred gives an output as 'Temperature & Moisture is less.'
What will be the python code to turn on the led based on this?
What I have tried:
I have tried :
from pyfirmata import util, Arduino
import time
def blink(b_time):
board = Arduino('COM5')
it = util.Iterator(board)
it.start()
led_13 = board.get_pin('d:13:o')
while True:
led_13.write(1)
print('Led ON')
time.sleep(b_time)
led_13.write(0)
print('Led OFF')
time.sleep(b_time)
if __name__ == '__main__':
blink(0.2)
inorder to check whether the led will turn on or not. And the led turned on. Now I want to know how can I turn the LED based on the conditions provided above.