Exemple #1
0
        simpleio.map_range(MotorPotOut, 0, 2**16 - 1, 0, 100))

    #-----------------------------------------------------

    #Just here becauses it is paired with the RPS printing Below
    if photoPin.value:
        lread = True
    elif fread == lread:
        interrupts += 1
        lread = not lread

#LCD 1 Second Updates

    if now - initial >= 1:
        lcd.clear()
        lcd.set_cursor_pos(0, 0)  #clears and resets LCD

        if (MotorPotOut <= 5000):
            lcd.print(str("Speed: 0"))
        elif (MotorPotOut >= 60000):
            lcd.print("Speed: 100")
        else:
            lcd.print(("Speed: ") + (str(displayMotorPotOut)))

        #RPS Printing
        lcd.set_cursor_pos(1, 0)
        lcd.print(("RPS: ") + str(interrupts))
        interrupts = 0

        #End of the 1 Second Check
        initial = time.monotonic()
from lcd.lcd import LCD
from lcd.i2c_pcf8574_interface import I2CPCF8574Interface

from lcd.lcd import CursorMode

# Talk to the LCD at I2C address 0x27.
# The number of rows and columns defaults to 4x20, so those
# arguments could be omitted in this case.
lcd = LCD(I2CPCF8574Interface(0x27), num_rows=4, num_cols=20)

lcd.print("abc ")
lcd.print("This is quite long and will wrap onto the next line automatically.")

lcd.clear()

# Start at the second line, fifth column (numbering from zero).
lcd.set_cursor_pos(1, 4)
lcd.print("Here I am")

# Make the cursor visible as a line.
lcd.set_cursor_mode(CursorMode.LINE)
from lcd.i2c_pcf8574_interface import I2CPCF8574Interface
from lcd.lcd import CursorMode

import time
from digitalio import DigitalInOut, Direction, Pull
import board

button = DigitalInOut(board.D2)
button.direction = Direction.INPUT  # sets the button pin for receiving input
button.pull = Pull.UP  # provides power for button

presses = 0  # creates a counter for how many times the button has been pressed

lcd = LCD(I2CPCF8574Interface(0x3F), num_rows=2, num_cols=16)

lcd.set_cursor_mode(CursorMode.LINE)  # Make the cursor visible as a line.

lcd.set_cursor_pos(0, 2)  # Sets position of cursor.
lcd.print("Booting up!")
time.sleep(.5)

while True:
    lcd.set_cursor_pos(0, 0)  # Sets position of cursor.
    lcd.print("Button Presses:")
    if not button.value:
        presses += 1  # shorter way of saying presses = presses + 1
    lcd.set_cursor_pos(1, 0)  # Sets position of cursor.
    lcd.print(str(presses))
    print(button.value)  # tells me if the button is getting pressed
    time.sleep(.01)  # stops it from looping a zillion times a second
Exemple #4
0
from lcd.lcd import LCD #Getting the LCD from the lcd library
from lcd.lcd import CursorMode #Lets you use cursor mode with the lcd
from lcd.i2c_pcf8574_interface import I2CPCF8574Interface #Importing the LCD backpack
lcd = LCD(I2CPCF8574Interface(0x27), num_rows=2, num_cols=16) #LCD setup

counter = 0 #The counter starts at zero

button = DigitalInOut(board.D2) #My button is connected to digital pin 2
button.direction = Direction.INPUT #The button is collecting information, therfore it is an input
button.pull = Pull.UP 

switch = DigitalInOut(board.D8) #My switch is connected to digital pin 8
switch.direction = Direction.INPUT #The switch is also an input
switch.pull = Pull.UP

lcd.set_cursor_pos(1,0) #Printing SwitchState: in the first spot of the second row
lcd.print("SwitchState:")

while True:
    if not button.value and oldButton:#If the button is being pressed, and it has been lifted since the last time it was pressed
        print("pressed!") #The serial monitor will let me know when the button is pressed
        lcd.set_cursor_pos(0,0) #Starting in the very first position
        lcd.print("Presses:   ") #The lcd screen will show the number of times the button has been pressed
        lcd.print(str(counter)) #Printing the number of presses to the lcd
        lcd.print("  ") #Formatting to make the lcd printing and spacing look right
        #time.sleep(.05)
        if switch.value: #If the switch is off
            lcd.set_cursor_pos(1,0)
            lcd.print("SwitchState:DOWN") #Printing to the lcd the state of the switch
            print("switch") #Let me know on the serial monitor that the switch has been flipped
            counter = counter - 1 #Count down
Exemple #5
0
import board
from lcd.lcd import LCD
from lcd.i2c_pcf8574_interface import I2CPCF8574Interface
from lcd.lcd import CursorMode
from digitalio import DigitalInOut
import time
# Talk to the LCD at I2C address 0x27 or 0x3F.
lcd = LCD(I2CPCF8574Interface(0x3F), num_rows=2, num_cols=16)
button = DigitalInOut(board.D2)

lcd.print("Ready?")
time.sleep(0.05)
lcd.clear()

# Start at the second line, fifth column (numbering from zero).
lcd.set_cursor_pos(1, 2)
lcd.print("Button Presses :")
lcd.print(0)
while True:

    if button.value:  # button is pushed
    lcd.print(++)
    time.sleep(0.05)
# Make the cursor visible as a line.
lcd.set_cursor_mode(CursorMode.LINE)
Exemple #6
0
# Bob K.
# https://github.com/jkammau97/CircuitPython

import time

import digitalio
import board
photoPin = digitalio.DigitalInOut(board.D5)
photoPin.direction = digitalio.Direction.INPUT
photoPin.pull = digitalio.Pull.UP

from lcd.lcd import LCD
from lcd.i2c_pcf8574_interface import I2CPCF8574Interface
lcd = LCD(I2CPCF8574Interface(0x3f), num_rows=2, num_cols=16)

lcd.set_cursor_pos(0, 0)
lcd.print("The number of interrupts is ")

init = time.monotonic()

count = 0
pastInterrupt = False
#returns amount of time elapsed since the program started in SECONDS
while True:
    interrupted = photoPin.value
    now = time.monotonic()
    if interrupted and not (pastInterrupt):
        count = count + 1
        print("interrupt")
    pastInterrupt = interrupted
# Here I'm establishing a button and a switch. (They are created the same way.)
button = DigitalInOut(board.D8)
button.direction = Direction.INPUT  # (Input= giving information, Output = receiving info/commands)
button.pull = Pull.UP

switch = DigitalInOut(board.D7)
switch.direction = Direction.INPUT
switch.pull = Pull.UP

# Talk to the LCD at I2C address 0x27.
# The number of rows and columns defaults to 4x20, so those arguments could be omitted in this case.
lcd = LCD(I2CPCF8574Interface(0x3f), num_rows=2, num_cols=16)

# Setting where I want the words to print
lcd.set_cursor_pos(1, 4)
lcd.print("Here I am")
time.sleep(0.1)
lcd.clear()

counter = 0

# I used a variable to make sure the counter didn't just run for the whole time I pushed the button down.
# To do this, I created two variables: now and last, to see if the button had just been pressed or if it was being pressed for a while.
now = True
last = True

switchValue = True

while True:
    now = button.value
Exemple #8
0
from lcd.i2c_pcf8574_interface import I2CPCF8574Interface
from lcd.lcd import CursorMode

switch = DigitalInOut(board.D7)
button = DigitalInOut(board.D2)
switch.direction = Direction.INPUT
button.direction = Direction.INPUT
switch.pull = Pull.DOWN
button.pull = Pull.DOWN
presses = 0
direction = 1
lcd = LCD(I2CPCF8574Interface(0x27), num_rows=2, num_cols=16)
toggle1 = 0

while True:
    lcd.set_cursor_pos(0, 0)
    lcd.print("Switch: ")
    lcd.set_cursor_pos(1, 0)
    lcd.print("Presses:")
    if switch.value and not button.value:
        direction = 1
        lcd.clear()
        lcd.set_cursor_pos(0, 8)
        lcd.print("UP")
        print("UP")
    if button.value and toggle1 == 0 and not switch.value:
        toggle1 = 1
        presses += direction
        lcd.set_cursor_pos(1, 9)
        lcd.print(str(presses))
        lcd.print("       ")
lcd.set_cursor_mode(CursorMode.LINE)

press = False #press starts at false until proven otherwise
x = 0       #starts at 0

while True:
    print(button.value)
    lcd.backlight = True       #backlight is on
    if not button.value:
        if (press == False):
            press = True   #if press does not equal false then press equals true
            if not switch.value:
                x = x -1        #if it does not equal switch value then it goes down by one
            if switch.value:
                x = x +1        #if it does equal switch value then it goes up by one
        print((0,))
    if button.value:
        press = False           #these print and display when it is false, which it is set to
    lcd.set_cursor_pos(0, 0)    #sets cursor to start of LCD screen in the first row (0,0)
    lcd.print("Presses: ")
    lcd.set_cursor_pos(0, 10)   #sets cursor to the end of LCD screen in the first row (0,10)
    lcd.print ( str (x))
    lcd.print ("    ")
    lcd.set_cursor_pos(1, 0)    #sets cursor to the start of LCD screen in the second row (1,0)
    lcd.print ("Switch:  ")
    if not switch.value:
        lcd.print ("DOWN")
    if switch.value:
        lcd.print ("UP  ")      #when switch is on value goes up, when it is off then value goes down
    time.sleep(0.05)
Exemple #10
0
button_a = digitalio.DigitalInOut(board.BUTTON_A)
button_a.direction = digitalio.Direction.INPUT
button_a.pull = digitalio.Pull.DOWN

button_b = digitalio.DigitalInOut(board.BUTTON_B)
button_b.direction = digitalio.Direction.INPUT
button_b.pull = digitalio.Pull.DOWN

# Talk to the LCD at I2C address 0x27.
# The number of rows and columns defaults to 4x20, so those
# arguments could be omitted in this case.
lcd = LCD(I2CPCF8574Interface(0x27), num_rows=4, num_cols=20)

lcd.print("abc ")
lcd.print("This is quite long and will wrap onto the next line automatically.")

lcd.clear()

# Start at the second line, fifth column (numbering from zero).
lcd.set_cursor_pos(0, 4)
lcd.print("lol")

# Make the cursor visible as a line.
lcd.set_cursor_mode(CursorMode.LINE)

while True:
    if button_a.value:
        print((1, ))
    elif button_b.value:
        print((2, ))
Exemple #11
0
import digitalio#pylint: disable-msg=import-error
from lcd.lcd import LCD#pylint: disable-msg=import-error
from lcd.i2c_pcf8574_interface import I2CPCF8574Interface#pylint: disable-msg=import-error

btnstate = False#used to see if button is pressed
oldbtnstate = False#used to see if button used to pressed(so it only increments once per press)
count = 0

lcd = LCD(I2CPCF8574Interface(0x3F), num_rows=2, num_cols=16)#creates an LCD object called "lcd" at adress 0x3F with 2 rows and 16 collumns

switch = digitalio.DigitalInOut(board.D12)#create a digitalio object called switch
switch.direction = digitalio.Direction.INPUT#set it to input


btn = digitalio.DigitalInOut(board.D13)
btn.direction = digitalio.Direction.INPUT
btn.pull = digitalio.Pull.UP#lets the button use a pull up resistor which means it will read HIGH when not being pressed

lcd.set_cursor_pos(0, 0)#moves the cursor to row 0 collumn 0
lcd.print("Button presses:")
while True:
    lcd.set_cursor_pos(1, 0)
    lcd.print(str(count))#turn integer count into a string, so it can be printed
    btnstate = btn.value
    if not btn.value and (btnstate == (not oldbtnstate)):#if button is pressed and it didn't used to be
        if switch.value:#determines if it counts up or down
            count += 1#set count equal to count + 1
        else:
            count -= 1
    oldbtnstate = btnstate
    lcd.print("          ")#clears screen
Exemple #12
0
setScreen()
# print(values[kP], "\t", values[kI], "\t", values[kD], "\t", values[3])

time.sleep(5)

while True:
    valSelect = int(moveCursor())
    print(valSelect)
    if valSelect == 0:
        values[kP] = simpleio.map_range(valPot.value, 0, 65535, 0.0, 10.0)
    if valSelect == 1:
        values[kI] = simpleio.map_range(valPot.value, 0, 65535, 0.0, 10.0)
    if valSelect == 2:
        values[kD] = simpleio.map_range(valPot.value, 0, 65535, 0.0, 10.0)
    if valSelect == 3:
        if valPot.value > (65535 / 2):
            PID = True
            lcd1.set_cursor_pos(1, 12)
            lcd1.print("On  ")
        else:
            PID = False
            lcd1.set_cursor_pos(1, 12)
            lcd1.print("Off ")
    if values != oldValues:
        setScreen()

    print(values, "\t", oldValues)

    oldValues = values
    time.sleep(1)
SwitchState = digitalio.DigitalInOut(board.D3)
SwitchState.direction = digitalio.Direction.INPUT
SwitchState.pull = digitalio.Pull.UP

lcd = LCD(I2CPCF8574Interface(0x27), num_rows=2, num_cols=16)

counter = 0
oldSwitchState = 0
newSwitchState = 1
adder = 1

while True:

    lcd.clear()  # clears LCD
    lcd.set_cursor_pos(1, 0)  # sets position of LCD text
    lcd.print("pressed:")

    lcd.set_cursor_pos(1, 9)
    lcd.print(str(counter))  # prints the string number

    if button.value:
        print("0")
        time.sleep(0.05)
        oldSwitchState = 0

    elif oldSwitchState == 0 and newSwitchState == 1:

        if SwitchState.value:  # When the switch is on this makes the counter go up
            adder = 1
        else:  # When the swtich is off makes the counter go down
import board
import touchio
import time
from lcd.lcd import LCD
from lcd.i2c_pcf8574_interface import I2CPCF8574Interface

# some LCDs are 0x3f... some are 0x27, import all libraries for lcd
lcd = LCD(I2CPCF8574Interface(0x27), num_rows=2, num_cols=16)
state = True
yellow = touchio.TouchIn(board.A3)  # establishes yellow wire at A3
blue = touchio.TouchIn(board.A4)  # establishes blue wire at A4
lcd.set_cursor_pos(0, 0)  # starting position is first row of lcd
time.sleep(2)
counter = 0  # counter starts at zero

print("running")
while True:

    if blue.value:  #  blue wire toggles counter direction
        message = "GOING UP  "  #  prints direction
        state = False

    else:
        message = "GOING DOWN "  #  prints direction
        state = True

    lcd.set_cursor_pos(0, 0)  #  first row of lcd screen
    lcd.print(message)  # print direction "up or down"
    if state is True:  # if direction is down
        direction = -1  # subtract 1 from counter
    else:  # if direction is up
Exemple #15
0
from lcd.lcd import CursorMode

button = DigitalInOut(board.D2)
button.direction = Direction.INPUT
button.pull = Pull.DOWN
switch = DigitalInOut(board.D3)
switch.direction = Direction.INPUT
switch.pull = Pull.DOWN

clicks = 0
clicks2 = 1
lcd = LCD(I2CPCF8574Interface(0x27), num_rows=2, num_cols=16)

while True:
    #if not button.value and oldButton:
    lcd.set_cursor_pos(0, 0)
    lcd.print("Switch")
    lcd.set_cursor_pos(1, 0)
    lcd.print("presses")

    if switch.value:
        clicks2 = -1

        lcd.set_cursor_pos(0, 7)
        lcd.print(" Down ")
        lcd.print("  ")
        lcd.set_cursor_pos(0, 7)
    if switch.value and clicks2 == -1:
        clicks2 = 1
        lcd.set_cursor_pos(0, 7)
        lcd.print(" Up ")
Exemple #16
0
import time
import board
from digitalio import DigitalInOut, Direction, Pull
from lcd.lcd import LCD
from lcd.i2c_pcf8574_interface import I2CPCF8574Interface
from lcd.lcd import CursorMode
led = DigitalInOut(board.D13)
lcd = LCD(I2CPCF8574Interface(0x27), num_rows=2, num_cols=16)
switch = DigitalInOut(board.D2)
switch.direction = Direction.INPUT
switch.pull = Pull.UP
value = 0
lcd.set_cursor_pos(0, 1)
lcd.print("ButtonPress:")
while True:
    if switch.value:
        lcd.set_cursor_pos(0, 14)
    else:
        lcd.set_cursor_pos(0, 14)
        value = value + 1
        lcd.print(str(value))
        time.sleep(0.3)
Exemple #17
0
import digitalio
from lcd.lcd import CursorMode
switch = DigitalInOut(board.D2)
switch.direction = Direction.INPUT
switch.pull = Pull.UP
switch2 = DigitalInOut(board.D7)
switch2.direction = Direction.INPUT
switch2.pull = Pull.UP
# Talk to the LCD at I2C address 0x27.
# The number of rows and columns defaults to 4x20, so those
# arguments could be omitted in this case.
lcd = LCD(I2CPCF8574Interface(0x27), num_rows=2, num_cols=16)
presses = 0
fread = True
while True:
    lcd.set_cursor_pos(0, 0)  #sets cursor in proper position
    lcd.print("SwitchState:")
    if switch.value:
        fread = True  #logic so it doesn't repeat
    else:
        if fread == True:
            if switch2.value:
                lcd.print("Up")
                lcd.print("    ")  #spacer so it doesn't break
                presses += 1
                fread = not fread  #resets fread
            else:
                lcd.print("Down")
                lcd.print("    ")
                presses -= 1
                fread = not fread  #resets fread
Exemple #18
0
import time
# import math
import board
from lcd.lcd import LCD
from lcd.i2c_pcf8574_interface import I2CPCF8574Interface
from digitalio import DigitalInOut, Direction, Pull
from lcd.lcd import CursorMode
photo = DigitalInOut(board.D8)

photo.direction = Direction.INPUT
photo.pull = Pull.UP
lcd = LCD(I2CPCF8574Interface(0x3f), num_rows=2, num_cols=16)
photoState = True
oldPhoto = True
value = 0

while True:
    photoState = photo.value

    if photoState and not oldPhoto:
        value = value + 1
        lcd.set_cursor_pos(1, 0)
        lcd.print(str(value))

    else:
        lcd.set_cursor_pos(1, 0)
        lcd.print(str(value))

    oldPhoto = photoState
from lcd.lcd import LCD
from lcd.i2c_pcf8574_interface import I2CPCF8574Interface

lcd = LCD(I2CPCF8574Interface(0x27), num_rows=2, num_cols=16)
PI = DigitalInOut(board.D5)
PI.direction = Direction.INPUT  #making photointerrupter pin and declaring as DigitalInOut object
PI.pull = Pull.UP

x = 0  #Set at zero until proven otherwise

interrupt = False
while True:
    #print(PI.value)
    lcd.backlight = True
    if PI.value:
        if interrupt == False:
            interrupt = True  #if interrupt isn't false then it is true
            x = x + 1  #count up by one if PI value
    if not PI.value:
        interrupt = False  #if not PI value then it is back to starting x=0
        x = x

    #print(("Interrupted"))
    if time.monotonic() % 4 == 0:  #print value every 4 times PI is interrupted
        lcd.set_cursor_pos(0, 0)  #cursor at start of first row
        lcd.print("Interrupted: ")
        lcd.set_cursor_pos(0, 12)  #cursor at end of first row
        lcd.print(str(x))
        lcd.set_cursor_pos(1, 0)  #cursor at start of second row
        lcd.print("Times")
Exemple #20
0
from lcd.lcd import LCD
from lcd.i2c_pcf8574_interface import I2CPCF8574Interface
from lcd.lcd import CursorMode
import time
import board
from digitalio import DigitalInOut, Direction, Pull

lcd = LCD(I2CPCF8574Interface(0x27), num_rows=2,
          num_cols=16)  #setting up the lcd
lcd.set_cursor_pos(0, 0)  #where the lcd will start printing

button = DigitalInOut(board.D2)  #setting the pin for button
button.direction = Direction.INPUT
button.pull = Pull.UP  #

switch = DigitalInOut(board.D13)  #setting the pin for switch
switch.direction = Direction.INPUT
switch.pull = Pull.UP

counter = 0  #counter starts at zero

now = True
later = True
switchValue = True

while True:
    now = button.value
    switchValue = switch.value
    print(str(switchValue))  #print if the switch is up or down
    if now == False and later == True:
        if switchValue:  #if switch is up count up
Exemple #21
0
for i in settings["actions"]:
    actions.append(
        FX.action(i["name"], i["type"], i["program"], i["value"], False))
    log(str("Action Action: " + i["name"]))

lcd.print("#")

# Import Footswitches
x = 0
for i in settings["FSAction"]:
    FootSwitches[x].setAction(actions[i["action"]], actions[i["holdAction"]])
    x = x + 1
log(str("Set Up Footswitches"))
lcd.print("#")

lcd.set_cursor_pos(3, 10)
lcd.print("Done!     ")

currentSongNo = settings["currentSong"]
songNo = currentSongNo


# GUI Reprint Function
def PrintGui(l3Mode, FSLine, DeviceMode):
    if DeviceMode == "Stomp":
        lcd.print(ui.line0(songs[currentSongNo], "Both"))
        lcd.print(ui.line1(songs[int(currentSongNo - 1)], "Both"))
        lcd.print(ui.line2(songs[int(currentSongNo + 1)], "Both"))
        lcd.print(ui.line3(mode, l3Mode, FSLine))
    elif DeviceMode == "Live":
        lcd.print(ui.line0(set, "Live"))
Exemple #22
0
switch.pull = Pull.UP
lcd.set_cursor_mode(CursorMode.LINE)

press = False
x = 0

while True:
    print(button.value)
    lcd.backlight = True
    if not button.value:
        if (press == False):
            press = True
            if not switch.value:
                x = x - 1
            if switch.value:
                x = x + 1
        print((0, ))
    if button.value:
        press = False
    lcd.set_cursor_pos(0, 0)
    lcd.print("Presses: ")
    lcd.set_cursor_pos(0, 10)
    lcd.print(str(x))
    lcd.print("    ")
    lcd.set_cursor_pos(1, 0)
    lcd.print("Switch:  ")
    if not switch.value:
        lcd.print("DOWN")
    if switch.value:
        lcd.print("UP  ")
    time.sleep(0.05)
Exemple #23
0
import time
import board
import digitalio
from digitalio import DigitalInOut, Direction, Pull
from lcd.lcd import LCD  # import necessary LCD libraries
from lcd.i2c_pcf8574_interface import I2CPCF8574Interface
from lcd.lcd import CursorMode
lcd = LCD(I2CPCF8574Interface(0x3F), num_rows=2,
          num_cols=16)  # sets up LCD screen, 2 x 16

redbutton = digitalio.DigitalInOut(board.D2)  #redbutton on pin D2
redbutton.direction = digitalio.Direction.INPUT  # button is on output
redbutton.pull = digitalio.Pull.UP  #pulling voltage direction

lcd.print("pushes ")  #prints the word pushes on LCD screen
presses = 0  #variable "pushes" equals 0

lcd.set_cursor_mode(
    CursorMode.LINE
)  #moves the cursor down a line on LCD screen for future prints

while True:
    if redbutton.value:  # if the redbutton isn't pressed...
        lcd.set_cursor_pos(1, 4)  #setting cursor position
        lcd.print("PRESSES")
    else:  # when the button is pressed...
        lcd.set_cursor_pos(1, 4)  #setting cursor position
        presses += 1  # add 1 to the presses variable
        lcd.print(presses)  # prints number of presses
        time.sleep
Exemple #24
0
button.direction = digitalio.Direction.INPUT  #setup button
button.pull = digitalio.Pull.DOWN

switch = digitalio.DigitalInOut(board.D5)
switch.direction = digitalio.Direction.INPUT  #setup switch
switch.pull = digitalio.Pull.DOWN

upDown = 1
buttonState = 0  #create variables
number = 0

while True:  #loop

    if not buttonState and button.value:
        number += upDown  #count when button is pressed
    buttonState = button.value

    if switch.value:
        upDown = 1  #should the number go up or down?
    else:
        upDown = -1

    lcd.set_cursor_pos(0, 0)
    lcd.print("up or down: ")
    if upDown == 1:
        lcd.print("up  ")  #print things to LCD
    else:
        lcd.print("down")
    lcd.print("number is: ")
    lcd.print(str(number))
    lcd.print("    ")
Exemple #25
0
button = DigitalInOut(board.D2)
button.direction = Direction.INPUT
button.pull = Pull.DOWN
switch = DigitalInOut(board.D3)
switch.direction = Direction.INPUT
switch.pull = Pull.DOWN

clicks = 0
clicks2 = 1
lcd = LCD(I2CPCF8574Interface(0x27), num_rows=2, num_cols=16)
#oldButton = False

while True:
    if not button.value:  # and oldButton:
        lcd.set_cursor_pos(0, 0)
        lcd.print("Switch")
        lcd.set_cursor_pos(1, 0)
        lcd.print("presses")

        if switch.value:
            clicks2 = -1  # Make it go down

            lcd.set_cursor_pos(0, 7)
            lcd.print(" Down ")
            lcd.print("  ")
            lcd.set_cursor_pos(0, 7)
        if switch.value and clicks2 == -1:  # make it go up
            clicks2 = 1
            lcd.set_cursor_pos(0, 7)
            lcd.print(" Up ")