Пример #1
0
def welcomeMessage():
    oledExp.setVerbosity(0)
    oledExp.driverInit()
    oledExp.setCursor(3, 0)
    oledExp.write("Welcome to OnionOmega")
    oledExp.setCursor(4, 0)
    oledExp.write("Data Logger Project")
    time.sleep(2)
Пример #2
0
def init(dirName):
	oledExp.setVerbosity(-1)
	status  = oledExp.driverInit()
	if status != 0:
		print 'ERROR initializing OLED Expansion'

	## setup the display
	# draw the plant image to the screen
	imgFile = dirName + "/thermometer.oled"
	if os.path.exists(imgFile):
		status = oledExp.drawFromFile(imgFile)

	## write the default text
	# write the first word on the second line and the right side of the screen
	oledExp.setTextColumns()
	oledExp.setCursor(1,12)
	oledExp.write('Temp:')
Пример #3
0
from OmegaExpansion import oledExp
import time


print 'Starting to use oled-exp functions...'

oledExp.setVerbosity(0)


# initialize
ret 	= oledExp.driverInit()
print "driverInit return: ", ret
if (ret != 0):
	exit()

# write a character
ret 	= oledExp.writeChar('x')
print "writeChar return: ", ret
if (ret != 0):
	exit()
time.sleep(2)

# invert the colours
ret 	= oledExp.setDisplayMode(1)
print "setDisplayMode return: ", ret
if (ret != 0):
	exit()
time.sleep(2)

# dim
ret 	= oledExp.setDim(1)
Пример #4
0
# oled expansion helper

from OmegaExpansion import oledExp

MAX_CHARACTERS = 21

oledExp.setVerbosity(-1)
oledExp.driverInit()
oledExp.clear()


def clear():
    oledExp.clear()


def writeLines(lines, startingRow=0, startingColumn=0, printBlock=False):
    # set the cursor to the beginning of the row where you want to start printing
    oledExp.setCursor(startingRow, startingColumn)

    # write the lines row by row
    for i in range(0, len(lines)):
        # choose between printing at column 0 on newlines
        # or printing from the same column
        if i == 0 or printBlock:
            column = startingColumn
        else:
            column = 0

        oledExp.setCursor(startingRow + i, column)
        oledExp.write(lines[i])
Пример #5
0
from OmegaExpansion import oledExp
import time

print 'Starting to use oled-exp functions...'

oledExp.setVerbosity(0)

# initialize
ret = oledExp.driverInit()
print "driverInit return: ", ret
if (ret != 0):
    exit()

# write a character
ret = oledExp.writeChar('x')
print "writeChar return: ", ret
if (ret != 0):
    exit()
time.sleep(2)

# invert the colours
ret = oledExp.setDisplayMode(1)
print "setDisplayMode return: ", ret
if (ret != 0):
    exit()
time.sleep(2)

# dim
ret = oledExp.setDim(1)
print "setDim return: ", ret
if (ret != 0):