Merge pull request #2 from bpoteryko/master

Updated version numbers, quick bugfix
This commit is contained in:
Morten Kals
2019-05-03 13:16:25 -07:00
committed by GitHub
2 changed files with 3 additions and 56 deletions

View File

@@ -496,59 +496,6 @@ class Arduino(object):
except:
return None
# Bryan's attempt at extending this package's functionality to include the ability to write text to the Arduino screen.
# I will ignore drawing anything fancy, and just focus on displaying text. If fancy drawings are seen to be useful, they can be added later.
# There will be several functions. One to clear and reset the display,
# one to set up the display to draw things, and one to actually draw the text (the most resource-intensive, so should be called at the end)
# Let's do this.
def setupDisplay(self):
"""
Sets up a I2C-connected SSD1306 display to receive data. This sends
the command 'scs' to the Arduino (SCreen Setup).
Inputs: (TODO)
width: width of the display, in pixels.
height: height of the display, in pixels.
"""
width = 128
height = 32
cmd_str = build_cmd_str("scs", (width, height))
try:
self.sr.write(str.encode(cmd_str))
self.sr.flush()
except:
pass
# not sure what this does
# rd = self.sr.readline().decode("utf-8").replace("\r\n", "")
# try:
# return int(rd)
# except:
# return 0
def clearDisplay(self):
"""
Clears the connected display from its previously-set values. Should
be called before writing anything new to the display.
This sends the command 'scc' to the Arduino (SCreen Clear).
"""
cmd_str = build_cmd_str("scc")
try:
self.sr.write(str.encode(cmd_str))
self.sr.flush()
except:
pass
def displayText(self, text, fontsize=1):
"""

View File

@@ -328,13 +328,13 @@ DHT dhtSensor(dhtSensorPin, DHT11);
void dht(String data) {
String sdata[2];
split(sdata, 2, data, '%');
int dataPin = sdata[0].toInt();
int sensorNumber = sdata[1].toInt();
int sensorType = DHT11; // assume DHT11 as default
if (sensorNumber == 1) {
// split(sdata, 2, data, '%');
sensorType = DHT12;
sensorType = DHT12;
} else if (sensorNumber == 2) {
sensorType = DHT21;
} else if (sensorNumber == 2) {
@@ -400,7 +400,7 @@ void displayText(String data) {
// Prints the above to the display. Relatively resource-intensive.
display.display();
delay(50);
delay(100);
}
// TODO: try a switch statement, might save memory.