Escolar Documentos
Profissional Documentos
Cultura Documentos
Hardware necessário
- Arduino
- PC com windows ou linux, ou Mac.
- Sensor de umidade e temperatura DHT22
Softwares necessários
- Arduino IDE
- Python 2.x ou 3.x
- Biblioteca pySerial
- Biblioteca MatplotLib Sensor DHT22
- Biblioteca NumPy
//Inicializa o sensor.
dht.begin();
}
currentHumidity = dht.readHumidity();
currentTemperature = dht.readTemperature();
selectedPortIndex = 1;
selectedDevice = "";
ports = list_ports.comports();
print("Avaiable ports:\n%s"%"\n".join(["\t%d: %s"%
(portIndex,str(ports[portIndex])) for portIndex in range(len(ports))]));
selectedDevice = ports[selectedPortIndex].device;
print("Selected device: %s"%selectedDevice);
ports = list_ports.comports();
print("Avaiable ports:\n%s"%"\n".join(["\t%d: %s"%
(portIndex,str(ports[portIndex])) for portIndex in range(len(ports))]));
selectedDevice = ports[selectedPortIndex].device;
print("Selected device: %s"%selectedDevice);
temperatureHistory = [];
humidityHistory = [];
fig = plt.figure();