Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
openhomeautomation authored and openhomeautomation committed Feb 7, 2014
1 parent 0c9ded1 commit dff652d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
19 changes: 11 additions & 8 deletions sensor_bluetooth/sensor_bluetooth.ino
@@ -1,11 +1,12 @@
// Bluetooth temperature sensor
#include "DHT.h"

// Pin for the DHT11 sensor
// Pin for the DHT sensor
#define DHTPIN 7
#define DHTTYPE DHT11
#define DHTTYPE DHT22
// #define DHTTYPE DHT11

// Create instance for the DHT11 sensor
// Create instance for the DHT sensor
DHT dht(DHTPIN, DHTTYPE);

// Setup
Expand All @@ -27,12 +28,14 @@ void loop(void)
// If a measurement is required, measure data and send it back
if (c == 'm'){

int h = (int)dht.readHumidity();
int t = (int)dht.readTemperature();

float h = dht.readHumidity();
float t = dht.readTemperature();
// Send data (temperature,humidity)
Serial.println(String(t) + "," + String(h));

Serial.print(t);
Serial.print(",");
Serial.println(h);

}

}
Expand Down
6 changes: 3 additions & 3 deletions sensor_gui.py
Expand Up @@ -10,7 +10,7 @@
serial_port = '/dev/cu.AdafruitEZ-Link06d5-SPP'

# Test with USB-Serial connection
# serial_port = '/dev/tty.usbmodem1411'
# serial_port = '/dev/tty.usbmodem1421'

ser = serial.Serial(serial_port, serial_speed, timeout=1)

Expand All @@ -28,10 +28,10 @@ def measure(self):
if (data != ""):
processed_data = data.split(",")

self.temp_data.set("Temperature: " + str(processed_data[0]))
self.temp_data.set("Temperature: " + str(processed_data[0]) + " °C")
self.temperature.pack()

self.hum_data.set("Humidity: " + str(processed_data[1]))
self.hum_data.set("Humidity: " + str(processed_data[1]) + " %")
self.humidity.pack()

# Wait 1 second between each measurement
Expand Down

0 comments on commit dff652d

Please sign in to comment.