import jetduino
from jetduino_pins import *

# Connect the Grove Temperature Sensor to analog port A0
# SIG,NC,VCC,GND
sensor = ARD_A0

oled.init()  #initialze SEEED OLED display

oled.clearDisplay()          #clear the screen and set start position to top left corner
oled.setNormalDisplay()      #Set display to normal mode (i.e non-inverse mode)
oled.setPageMode()           #Set addressing mode to Page Mode

oldTemp = -1
oled.setTextXY(0,0)
oled.putString("Temperature") #Print the String

jetduino.setAnalogReadResolution(10)

while True:
    try:
        celsius = jetduino.temp(sensor,'1.2')

        #if the temp changes write it out to the screen.
        if celsius > 0 and math.fabs(oldTemp - celsius) > 0.01: 
            print ("temp =", celsius)
            fahrenheit = (celsius * 1.8) + 32
            oled.setTextXY(0,1)
            oled.putString("%3.3f C" % celsius) #Print the String
            oled.setTextXY(0,2)
            oled.putString("%3.3f F" % fahrenheit) #Print the String
Esempio n. 2
0
 def println(self, string):
     oled.putString(self.toString(string) + '\n')
     self.line += 1
     oled.setTextXY(0, self.line)
Esempio n. 3
0
 def _print(self, string):
     oled.putString(self.toString(string))
Esempio n. 4
0
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
'''

import grove_128_64_oled as oled

oled.init()  #initialze SEEED OLED display

oled.clearDisplay()          #clear the screen and set start position to top left corner
oled.setNormalDisplay()      #Set display to normal mode (i.e non-inverse mode)
oled.setPageMode()           #Set addressing mode to Page Mode
for i in range(6):
	oled.setTextXY(i,i)          #Set the cursor to Xth Page, Yth Column  
	oled.putString("Hello World!") #Print the String
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
'''

import grove_128_64_oled as oled

oled.init()  #initialze SEEED OLED display

oled.clearDisplay(
)  #clear the screen and set start position to top left corner
oled.setNormalDisplay()  #Set display to normal mode (i.e non-inverse mode)
oled.setPageMode()  #Set addressing mode to Page Mode
for i in range(6):
    oled.setTextXY(i, i)  #Set the cursor to Xth Page, Yth Column
    oled.putString("Hello World!")  #Print the String
def oled_write_line(line, msg):
    oled.setTextXY(0, line)
    oled.putString('{0: <{1}}'.format(msg[0:16], 16))