Ejemplo n.º 1
0
def main():
    lcd = CharLCD(numbering_mode=GPIO.BOARD,
                  cols=16,
                  rows=2,
                  pin_rs=37,
                  pin_e=35,
                  pins_data=[33, 31, 29, 23])
    lcd.clear()
    lcd.cursor_pos = (0, 0)
    lcd.write_string(u'Scannez un tube')
    code = ''
    GPIO.setup(3, GPIO.IN)
    GPIO.add_event_detect(3, GPIO.BOTH, callback=close)

    while (True):
        inkey = Getch()
        k = inkey()

        if ord(k) == 27:
            GPIO.cleanup()
            call(['shutdown', 'now'])
            #quit()
        elif k == '\r':
            lcd.clear()
            lcd.cursor_pos = (0, 0)
            lcd.write_string(code)
            sleep(5)
            code = ''
            lcd.cursor_pos = (0, 0)
            lcd.write_string(u'Scannez un tube')

        elif k != '':
            code += k
Ejemplo n.º 2
0
def main():
    # initialize lcd screen
    lcd = CharLCD(cols=16,
                  rows=2,
                  pin_rs=37,
                  pin_e=35,
                  pins_data=[33, 31, 29, 23])

    # DHT22 sensor is only accurate to +/- 2% humidity and +/- 0.5 celsius
    # Poll 10 times and calculate median to get more accurate value
    templist = []
    humidlist = []

    lcd.cursor_pos = (0, 0)
    lcd.write_string("Polling...")
    lcd.cursor_pos = (1, 0)
    bar = "[----------]"
    lcd.write_string(bar)
    lcd.clear()

    for i in range(1, 11):
        data = poll()

        lcd.cursor_pos = (0, 0)
        lcd.write_string("Polling....")
        lcd.cursor_pos = (1, 0)

        bar = list(bar)
        bar[i] = '#'
        bar = ''.join(bar)
        lcd.write_string(bar)

        # Don't poll more often than every 2 seconds
        sleep(3)
        lcd.clear()
        temp = int(round(data[0]))
        humid = int(round(data[1]))
        templist.append(temp)
        humidlist.append(humid)

    lcd.clear()

    # Calculate median value
    temp = (sorted(templist))[5]
    humid = (sorted(humidlist))[5]

    # Display results to LCD
    display(lcd, temp, humid)

    # Write data to CSV file for later analysis
    write_data(temp, humid)

    # Clears the screen / resets cursor position and closes connection
    lcd.clear()
    lcd.close(clear=True)
Ejemplo n.º 3
0
def write_to_lcd(ifname):

    lcd = CharLCD()

    lcd.clear()
    lcd.home()
    lcd.write_string(get_hostname())
    lcd.cursor_pos = (1, 0)
    lcd.write_string(get_device_type())
    lcd.cursor_pos = (2, 0)
    lcd.write_string(get_ip_address(ifname))
Ejemplo n.º 4
0
import time                         #import delay time
import RPi.GPIO as GPIO             #connect to RPi Pins
from RPLCD import CharLCD           #connect to LCD. showing character
from RPLCD import cleared           #connect to LCD. clear LCD
GPIO.setwarnings(False)             #disable warnings
 

#define pins
lcd = CharLCD(cols=16, rows=2, pin_rw=None,     #16*2 LCD
              pin_rs=7, pin_e=8,                #pin_reset and pin_enable
              pins_data=[25,24,23,18],          #pin_data 
              numbering_mode=GPIO.BCM)          #BCM mode

              
#main loop
while True:                                   #unlimited loop
    lcd.cursor_pos=(0,0)                      #define start point column=0 row=0
    lcd.write_string('Mohammad Javad')        #sample text
    time.sleep(1)                             #delay time
    with cleared(lcd):
        lcd.write_string(u'')                 #clear LCD

    lcd.cursor_pos=(1,0)                      #define start point: column=0 row=1
    lcd.write_string('Najafi Rad')            #sample text
    time.sleep(1)                             #delay time
    with cleared(lcd):
        lcd.write_string(u'')                 #clear LCD

    
    
Ejemplo n.º 5
0
                pin_rs=21,
                pin_e=20,
                pins_data=[18,23,24,25],
				#d4, d5, d6, d7
                numbering_mode=GPIO.BCM)
lcd.cursor_mode = CursorMode.blink
my_cmd = ""
my_username = getpass.getuser()
my_perl = ""
lcd.write_string("Press ENTER for LCD terminal")
print "\nPress ENTER for LCD terminal\n";
my_wait = subprocess.check_output("/etc/wait.pl ",shell=True)
if my_wait == "Timeout":
	lcd.clear()
	my_name = subprocess.check_output("hostname -A",shell=True)
	lcd.cursor_pos = (0,0)
	lcd.write_string(my_name)
	my_ip = subprocess.check_output("hostname -I",shell=True)
	lcd.cursor_pos = (2,0)
	lcd.write_string(my_ip)
	lcd.cursor_mode = CursorMode.hide
	exit(0)
while my_perl != "Success!":
	lcd.clear()
	my_name = subprocess.check_output("hostname -A",shell=True)
	lcd.write_string(my_name)
	lcd.cursor_pos = (1,0)
	my_ip = subprocess.check_output("hostname -I",shell=True)
	lcd.write_string(my_ip)
	lcd.cursor_pos = (3,0)
	lcd.write_string(my_username)
Ejemplo n.º 6
0
import RPi.GPIO as GPIO
from RPLCD import CharLCD
from time import sleep

# init
lcd = CharLCD(numbering_mode=GPIO.BCM,
              cols=16,
              rows=2,
              pin_rs=4,
              pin_e=17,
              pins_data=[18, 22, 23, 24])

# write string
lcd.write_string('Hello world!')

# write string to second line on 4th column
lcd.cursor_pos = (1, 3)
lcd.write_string('Huhu')

sleep(2)
lcd.clear()
sleep(1)

while True:
    lcd.write_string("This will loop")
    lcd.cursor_pos = (1, 4)
    lcd.write_string("forever...")
    sleep(1)
    lcd.clear()
    sleep(1)
Ejemplo n.º 7
0
    req = requests.get(BVG_STATION_URL)
    data = req.json()
    departures = data[0]['departures']
    last_update = datetime.datetime.now()


if __name__ == '__main__':
    GPIO.add_event_detect(7, GPIO.FALLING)
    GPIO.add_event_detect(12, GPIO.FALLING)
    GPIO.add_event_callback(7, next_callback, bouncetime=250)
    GPIO.add_event_callback(12, previous_callback, bouncetime=250)
    while True:
        button_pressed = last_button_pressed \
            and (datetime.datetime.now() - last_button_pressed).total_seconds() < 10 \
            or False
        if button_pressed or datetime.datetime.now().second % 10 <= 5:
            try:
                update_departures()
            except Exception as e:
                lcd.clear()
                lcd.write_string('oups')
                lcd.cursor_pos = (1, 0)
                lcd.write_string(('%s' % (e))[:15])
                traceback.print_exc()
            else:
                if departures:
                    print_departure_info(departures[index])
        else:
            print_time()
        time.sleep(1)
Ejemplo n.º 8
0
lcd.backlight = True
input('Display should be blank. ')

lcd.cursor_mode = CursorMode.blink
input('The cursor should now blink. ')

lcd.cursor_mode = CursorMode.line
input('The cursor should now be a line. ')

lcd.write_string('Hello world!')
input('"Hello world!" should be on the LCD. ')

assert lcd.cursor_pos == (0, 12), 'cursor_pos should now be (0, 12)'

lcd.cursor_pos = (1, 0)
lcd.write_string('2')
lcd.cursor_pos = (2, 0)
lcd.write_string('3')
lcd.cursor_pos = (3, 0)
lcd.write_string('4')
assert lcd.cursor_pos == (3, 1), 'cursor_pos should now be (3, 1)'
input('Lines 2, 3 and 4 should now be labelled with the right numbers. ')

lcd.clear()
input('Display should now be clear, cursor should be at initial position. ')

lcd.cursor_pos = (0, 5)
lcd.write_string('12345')
input('The string should have a left offset of 5 characters. ')
Ejemplo n.º 9
0
from RPLCD import CharLCD  # This is the library which we will be using for LCD Display
from RPi import GPIO  # This is the library which we will be using for using the GPIO pins of Raspberry PI
import socket  # This is the library which we will be using to check the socket and find IP
import fcntl
import struct

# Initializing the LCD Display
lcd = CharLCD(numbering_mode=GPIO.BOARD,
              cols=16,
              rows=2,
              pin_rs=37,
              pin_e=35,
              pins_data=[33, 31, 29, 23])


def get_ip_address(ifname):
    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    return socket.inet_ntoa(
        fcntl.ioctl(s.fileno(), 0x8915, struct.pack('256s',
                                                    ifname[:15]))[20:24])


lcd.write_string("IP Address:")

lcd.cursor_pos = (1, 0)
lcd.write_string(get_ip_address('eth0'))

# Always Clean Up the GPIO after using the code
GPIO.cleanup()
Ejemplo n.º 10
0
    while (1):
        score = 0
        streak = 0

        timeLimit = 60  #seconds

        digit = None

        wordsUsed = []
        for i in words:
            wordsUsed.append(True)

        # Attract Mode
        lcd.clear()
        lcd.cursor_pos = (0, 3)
        lcd.write_string("C.R.a.N.K.")
        lcd.cursor_pos = (1, 0)
        lcd.write_string("1:Space   #:Back")
        while (digit == None):
            digit = kp.getKey()

        lcd.clear()
        lcd.cursor_pos = (0, 3)
        lcd.write_string("Get ready")
        time.sleep(2)
        lcd.clear()

        startTime = time.time()
        while ((time.time() - startTime) <= timeLimit):
            # Word Generation
Ejemplo n.º 11
0
# We call a RPi.GPIO built-in function GPIO.cleanup() to clean up all the ports we've used
GPIO.cleanup()

# Now setup LCD display pins (8-bit mode)
lcd = CharLCD(numbering_mode=GPIO.BOARD, cols=16, rows=2, pin_rs=37, pin_e=35, pins_data=[40, 38, 36, 32, 33, 31, 29, 23])

# Get senosr readings and render them in a loop
while True:

    # Get sensor's readings
    # IMPORTANT: 11 is sensor type (DHT11) and 18 is GPIO number (or physical pin 12)
    humidity, temperature = Adafruit_DHT.read_retry(11, 18)

    print('Temp: {0:0.1f} C  Humidity: {1:0.1f} %'.format(temperature, humidity))

    # Clear and set initial cursor position for LCD display
    lcd.clear()
    lcd.cursor_pos = (0, 0)

    # Render temperature readings
    lcd.write_string("Temp: %d C" % temperature)

    #  Move cursor to second row
    lcd.cursor_pos = (1, 0)

    # Render humidity readings
    lcd.write_string("Humidity: %d %%" % humidity)

    # Pause execution for 5 seconds
    time.sleep(5)
Ejemplo n.º 12
0
## POSITION THE TEXT
'''
The text can be positioned anywhere on the screen using lcd.cursor_pos = (ROW, COLUMN).
The rows are numbered starting from zero, so the top row is row 0, and the bottom row is row 1. 
Similarly, the columns are numbered starting at zero, so for a 16×2 LCD the columns are numbered 0 to 15. 
For example, the code below places “Hello world!” starting at the bottom row, fourth column:
'''

from RPLCD import CharLCD  # This is the library which we will be using for LCD Display
from RPi import GPIO  # This is the library which we will be using for using the GPIO pins of Raspberry PI

# Initializing the LCD Display
lcd = CharLCD(numbering_mode=GPIO.BOARD,
              rows=2,
              pin_rs=37,
              pin_e=35,
              pins_data=[33, 31, 29, 23])

lcd.cursor_pos = (
    1, 3)  # This will place the cursor at row=(1+1)=2 and col=(3+1)=4
lcd.write_string("Hello world!")

# Always Clean Up the GPIO after using the code
GPIO.cleanup()
def send_pin():
    global step
    global lcd_flag
    global lcd

    s_pin = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

    host = global_host
    port = 1314

    adress = ((host, port))
    s_pin.connect(adress)

    matrix = [['1', '2', '3', 'A'],
              ['4', '5', '6', 'B'],
              ['7', '8', '9', 'C'],
              ['*', '0', '#', 'D']]

    row = [14, 15, 18, 23]
    col = [24, 25, 8, 7]

    for j in range(4):
        GPIO.setup(col[j], GPIO.OUT)
        GPIO.output(col[j], 1)

    for i in range(4):
        GPIO.setup(row[i], GPIO.IN, pull_up_down=GPIO.PUD_UP)

    text_pin = ''

    write_pin = 0

    m_pin = 0
    m_rfid = 0

    while True:
        for j in range(4):
            GPIO.output(col[j], 0)

            for i in range(4):
                if GPIO.input(row[i]) == 0:
                    if matrix[i][j] == 'D':
                        start = time.time()
                        while (GPIO.input(row[i]) == 0):
                            if (time.time() - start > 1.0) and (text_pin != '') and (step == 0 or step == 1):
                                s_pin.send(str.encode(text_pin))
                                data = s_pin.recv(4096)
                                data = data.decode('utf-8')
                                data_splitted = data.split('/')
                                if len(data_splitted) == 3:
                                    m_rfid = data_splitted[1]
                                    m_pin = data_splitted[2]
                                    if m_pin == '1':
                                        step = 1
                                        lcd_flag = 0
                                    elif m_rfid == '1':
                                        step = 2
                                        lcd_flag = 0
                                    elif (m_pin == '0') and (m_rfid == '0'):
                                        step = 5
                                        lcd_flag = 0
                                elif len(data_splitted) == 1:
                                    if data_splitted[0] == 'GOOD_PIN':
                                        if m_rfid == '1':
                                            step = 2
                                        else:
                                            step = 5
                                        lcd_flag = 0
                                    elif data_splitted[0] == 'WRONG_PIN':
                                        step = 3
                                        lcd_flag = 0
                                    elif data_splitted[0] == 'WRONG_MACHINE':
                                        m_pin = None
                                        m_rfid = None
                                        step = 8
                                        lcd_flag = 0
                                text_pin = ''
                                lcd.cursor_pos = (1, 0)
                                lcd.write_string(u'                ')
                                break
                        if (time.time() - start < 1.0) and (step == 0 or step == 1):
                            text_pin = text_pin[:-1]
                            lcd.cursor_pos = (1, 0)
                            if write_pin == 0:
                                lcd.write_string(text_pin+u' ')
                            if write_pin == 1:
                                lcd.write_string('*'*len(text_pin)+u' ')
                    else:
                        if (step == 0) or (step == 1):
                            text_pin += matrix[i][j]
                            lcd.cursor_pos = (1, 0)
                            if write_pin == 0:
                                lcd.write_string(text_pin)
                            if write_pin == 1:
                                lcd.write_string('*'*len(text_pin))
                        while (GPIO.input(row[i]) == 0):
                            pass

            GPIO.output(col[j], 1)

        if lcd_flag == 0:
            lcd.clear()
            if step == 0:
                lcd_flag = 1
                write_pin = 0
                lcd.cursor_pos = (0, 0)
                lcd.write_string(u'CHOOSE MACHINE')
            elif step == 1:
                lcd_flag = 1
                write_pin = 1
                lcd.cursor_pos = (0, 0)
                lcd.write_string(u'WRITE PIN')
            elif step == 2:
                lcd_flag = 1
                lcd.cursor_pos = (0, 0)
                lcd.write_string(u'PLACE RFID CARD')
                time.sleep(1)
            elif step == 3:
                lcd.cursor_pos = (0, 0)
                lcd.write_string(u'WRONG')
                lcd.cursor_pos = (1, 0)
                lcd.write_string(u'PIN')
                if m_rfid == '1':
                    s_pin.send(str.encode(' '))
                time.sleep(1)
                step = 0
            elif step == 4:
                lcd.cursor_pos = (0, 0)
                lcd.write_string(u'WRONG')
                lcd.cursor_pos = (1, 0)
                lcd.write_string(u'RFID CARD')
                s_pin.send(str.encode('WRONG_RFID'))
                time.sleep(1)
                step = 0
            elif step == 5:
                lcd_flag = 1
                lcd.cursor_pos = (0, 0)
                lcd.write_string(u'FACE')
                lcd.cursor_pos = (1, 0)
                lcd.write_string(u'RECOGNITION')
                if m_rfid == '1':
                    s_pin.send(str.encode(' '))
                time.sleep(2)
            elif step == 6:
                lcd.cursor_pos = (0, 0)
                lcd.write_string(u'WELCOME')
                lcd.cursor_pos = (1, 0)
                lcd.write_string(first_name + u' ' + second_name)
                time.sleep(3)
                lcd = CharLCD(numbering_mode=GPIO.BCM, cols=16, rows=2,
                              pin_rs=21, pin_e=20, pins_data=[16, 12, 27, 22],
                              compat_mode=True)
                lcd.clear()
                step = 0
            elif step == 7:
                lcd.cursor_pos = (0, 0)
                lcd.write_string(first_name + u' ' + second_name)
                lcd.cursor_pos = (1, 0)
                lcd.write_string(
                    u'H: ' + work_hours + u' M: ' + work_minutes + u' S: ' + work_seconds)
                time.sleep(3)
                lcd = CharLCD(numbering_mode=GPIO.BCM, cols=16, rows=2,
                              pin_rs=21, pin_e=20, pins_data=[16, 12, 27, 22],
                              compat_mode=True)
                lcd.clear()
                step = 0
            elif step == 8:
                lcd.cursor_pos = (0, 0)
                lcd.write_string(u'WRONG')
                lcd.cursor_pos = (1, 0)
                lcd.write_string(u'MACHINE')
                time.sleep(1)
                step = 0
              pin_e=19,
              pins_data=[13, 6, 5, 11],
              numbering_mode=GPIO.BCM)

GPIO.setwarnings(False)
GPIO.setup(11, GPIO.OUT)


def get_ip_address(ifname):
    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
    return socket.inet_ntoa(
        fcntl.ioctl(s.fileno(), 0x8915, struct.pack('256s',
                                                    ifname[:15]))[20:24])


lcd.cursor_pos = (0, 1)
lcd.write_string("Time: %s" % time.strftime("%H:%M:%S"))
lcd.cursor_pos = (1, 0)
lcd.write_string("Date: %s" % time.strftime("%m/%d/%Y"))
time.sleep(7)
lcd.clear()

humidity, temperature = Adafruit_DHT.read_retry(11, 4)
lcd.cursor_pos = (0, 3)
lcd.write_string("Temp: %d C" % temperature)
lcd.cursor_pos = (1, 1)
lcd.write_string("Humidity: %d %%" % humidity)
time.sleep(7)
lcd.clear()

lcd.cursor_pos = (0, 2)
Ejemplo n.º 15
0
lcd.backlight = True
input('Display should be blank. ')

lcd.cursor_mode = CursorMode.blink
input('The cursor should now blink. ')

lcd.cursor_mode = CursorMode.line
input('The cursor should now be a line. ')

lcd.write_string('Hello world!')
input('"Hello world!" should be on the LCD. ')

assert lcd.cursor_pos == (0, 12), 'cursor_pos should now be (0, 12)'

lcd.cursor_pos = (0, 15)
lcd.write_string('1')
lcd.cursor_pos = (1, 15)
lcd.write_string('2')
assert lcd.cursor_pos == (0, 0), 'cursor_pos should now be (0, 0)'
input(
    'Lines 1 and 2 should now be labelled with the right numbers on the right side. '
)

lcd.clear()
input('Display should now be clear, cursor should be at initial position. ')

lcd.cursor_pos = (0, 5)
lcd.write_string('12345')
input('The string should have a left offset of 5 characters. ')
Ejemplo n.º 16
0
                '  "run_profile": "none",\n' + '  "run_segment": "n/a",\n' +
                '  "ramptemp": "n/a",\n' + '  "status": "n/a",\n' +
                '  "targettemp": "n/a"\n' + '}\n')
    sfile.close()

    if wheel == '-':
        wheel = '\x02'
    elif wheel == '\x02':
        wheel = '|'
    elif wheel == '|':
        wheel = '/'
    else:
        wheel = '-'

    lcd.clear()
    lcd.cursor_pos = (0, 0)
    lcd.write_string(u'IDLE ' + wheel)
    lcd.cursor_pos = (2, 0)
    lcd.write_string(u'Temp ' + str(int(ReadTmp)) + '\x01')

    #{
    #  "proc_update_utime": "1506396470",
    #  "readtemp": "145",
    #  "run_profile": "none",
    #  "run_segment": "n/a",
    #  "targettemp": "n/a"
    #}

    # Check for 'Running' firing profile
    SQLConn = MySQLdb.connect(SQLHost, SQLUser, SQLPass, SQLDB)
    SQLCur = SQLConn.cursor()
Ejemplo n.º 17
0
              pins_data=[16, 15, 13, 11],
              numbering_mode=GPIO.BOARD)

artist = "Frank Ocean"  #input("What artist?")

album = "Blonde"  #input("What album?")

song = "*.mp3"  #input("What song?")

lcd.cuursor_pos = (0, 1)

lcd.write_string(artist)

time.sleep(1)

lcd.cursor_pos = (1, 0)

lcd.write_string(album)

time.sleep(1)

lcd.cursor_pos = (3, 0)

lcd.write_string('....................')

#music = "~/Music/" + artist + "/" + album + "/" + song

command = "mplayer -ao alsa:device=hw=1.0 ~/Music/'" + artist + "'/'" + album + "'/*.mp3 </dev/null >/dev/null 2>&1 &"
#there is better way to do this by creating playlist m3u files when importing the music
os.system(command)
Ejemplo n.º 18
0
lcd.backlight = True
input('Display should be blank. ')

lcd.cursor_mode = CursorMode.blink
input('The cursor should now blink. ')

lcd.cursor_mode = CursorMode.line
input('The cursor should now be a line. ')

lcd.write_string('Hello world!')
input('"Hello world!" should be on the LCD. ')

assert lcd.cursor_pos == (0, 12), 'cursor_pos should now be (0, 12)'

lcd.cursor_pos = (0, 15)
lcd.write_string('1')
lcd.cursor_pos = (1, 15)
lcd.write_string('2')
assert lcd.cursor_pos == (0, 0), 'cursor_pos should now be (0, 0)'
input('Lines 1 and 2 should now be labelled with the right numbers on the right side. ')

lcd.clear()
input('Display should now be clear, cursor should be at initial position. ')

lcd.cursor_pos = (0, 5)
lcd.write_string('12345')
input('The string should have a left offset of 5 characters. ')

lcd.write_shift_mode = ShiftMode.display
lcd.cursor_pos = (1, 5)
Ejemplo n.º 19
0
Archivo: ftf2.py Proyecto: verifie/BMS
#!/usr/bin/python3
#

from RPLCD import CharLCD
lcd = CharLCD()
lcd.write_string(u'Raspberry Pi HD44780')
lcd.cursor_pos = (2, 0)
lcd.write_string(u'http://github.com/\n\rdbrgn/RPLCD')
Ejemplo n.º 20
0
        temp_c = str(
            round(temp_c, 1)
        )  # ROUND THE RESULT TO 1 PLACE AFTER THE DECIMAL, THEN CONVERT IT TO A STRING
        return temp_c


#FAHRENHEIT CALCULATION
def read_temp_f():
    lines = read_temp_raw()
    while lines[0].strip()[-3:] != 'YES':
        time.sleep(0.2)
        lines = read_temp_raw()
    equals_pos = lines[1].find('t=')
    if equals_pos != -1:
        temp_string = lines[1][equals_pos + 2:]
        temp_f = (
            int(temp_string) / 1000.0
        ) * 9.0 / 5.0 + 32.0  # TEMP_STRING IS THE SENSOR OUTPUT, MAKE SURE IT'S AN INTEGER TO DO THE MATH
        temp_f = str(
            round(temp_f, 1)
        )  # ROUND THE RESULT TO 1 PLACE AFTER THE DECIMAL, THEN CONVERT IT TO A STRING
        return temp_f


while True:

    lcd.cursor_pos = (0, 0)
    lcd.write_string("Temp: " + read_temp_c() + unichr(223) + "C")
    lcd.cursor_pos = (1, 0)
    lcd.write_string("Temp: " + read_temp_f() + unichr(223) + "F")
#main loop

while True:
    counter += 1
    new_time = datetime.now().strftime('%H%M%d')
    month = datetime.now().strftime('%B')
    day_name = datetime.now().strftime('%A')
    if new_time!=old_time :
	    digits = str(new_time)
	    tens_hour = disp_number(digits[0], 0)
	    hour = disp_number(digits[1], 4)
	    tens_minutes = disp_number(digits[2], 9)
	    minutes = disp_number(digits[3], 13)
	    old_time = new_time
	    #lcd.write_string(digits)
    lcd.cursor_pos = (0, 7)
    lcd.write_string(unichr(3))
    lcd.cursor_pos = (1, 7)
    lcd.write_string(unichr(3))
    sleep(0.5)
    lcd.cursor_pos = (0, 7)
    lcd.write_string(unichr(254))
    lcd.cursor_pos = (1, 7)
    lcd.write_string(unichr(254))
    sleep(0.5)
    if counter==15 :    ## date display interval in seconds
        counter = 0
        shift("left")
        tens_day = disp_number(digits[4], 0)
        day = disp_number(digits[5], 4)
        lcd.cursor_pos = (0, 9)