I currently have an arduino code, which is connected to three sensors: temperature, pressure and humidity. I would like to make a code in python that of an order (by int or strg), this sends the type of sensor that I want to read, example: if I enter by keyboard 1, it constantly sends me temperature data; if income 2, send me pressure data; and thus be able to enter any digit at any time. Pd: Sorry my bad english,I don't know if i could explain my problem
I have a similar code in arduino with switch case, and it works perfectly. but I can not make it work in python since when I put raw_input (), the program stops waiting for input and stops reading the sensor data.
Python
import serial
import time
ser=serial.Serial('/dev/ttyUSB0',baudrate=115200)
while 1:
ser.setDRT(False)
#c=raw_input()
#ser.write(c)
med=a.readline()
print med
this just works fine to read data from one sensor type assigned by default