Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Updated version numbers, quick bugfix #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 0 additions & 53 deletions Arduino/arduino.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,59 +496,6 @@ def dht(self, pin, module = 0):
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):
"""
Expand Down
6 changes: 3 additions & 3 deletions sketches/prototype/prototype.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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.
Expand Down