Ejemplo n.º 1
0
	def __init__(self,port , num):
		p = getPin(port)
		if p[0] == None :
			return 
		self.rgb = NeoPixel(Pin(p[0]) , num , timing = True)
		self.tar = list(self.rgb)
Ejemplo n.º 2
0
from pn532 import PN532
from machine import Pin
from neopixel import NeoPixel
from utime import sleep_ms, ticks_ms, ticks_add, ticks_diff

np = NeoPixel(Pin(2), 24)
np.write()
pn = PN532()
cardid = None
colors = [(20, 0, 0), (15, 15, 0), (0, 20, 0), (0, 15, 15), (0, 0, 20),
          (15, 0, 15)]
for r in range(6000):
    ct = ticks_add(ticks_ms(), 10)
    try:
        pn.mainloop()
    except:
        sleep_ms(100)
        continue
    if pn.cardid != cardid:
        cardid = pn.cardid
        if cardid:
            print("Card: %08x" % cardid)
            for i in range(24):
                np[i] = colors[i % 6]
    if (r % 2) == 0:
        for i in range(24):
            np[i] = (max(0, np[i][0] - 1), max(0, np[i][1] - 1),
                     max(0, np[i][2] - 1))
        np.write()
    et = ticks_diff(ct, ticks_ms())
    if et > 0:
from machine import Pin
from neopixel import NeoPixel
import time

n = 7  # Set the number of pixels on your NeoPixel
pin = Pin(5, Pin.OUT)  # setup GPIO5 pin (D1) as output to drive the NeoPixelsi
np = NeoPixel(pin, n)  # create NeoPixel object on GPIO5, for n pixels
np[0] = (255, 255, 255)  # set the first pixel to white
np.write()  # write data to all pixels
np[0] = (0, 0, 0)  # set the first pixel to nothing (black)
np.write()  # write data to all pixels


def single_colour(r, g, b, brightness):
    for i in range(n):
        np[i] = (r * brightness // 100, g * brightness // 100,
                 b * brightness // 100)
    np.write()


def cycle():
    for i in range(
            4 * n
    ):  # setup a loop that lasts 4 times the number of NeoPixels and turns each LED on
        for j in range(
                n
        ):  # setup a nested loop that goes thru each pixel and turns the other LEDs off
            np[j] = (0, 0, 0)
        np[i % n] = (
            255, 255, 255
        )  # turns one of n LEDs white in sequence with modulo ie 1 % 7 = 0, 7 % 7 = 0..8 % 7 = 1, 9 & 7 = 2..13 % 7 = 6, 14 % 7 = 0, and onwards to 4 * n
Ejemplo n.º 4
0
from time import sleep
from neopixel import NeoPixel
from machine import Pin

dataPin = Pin(4)
ledCount = 64
np = NeoPixel(dataPin, ledCount)

fontColumns = [
    95, 95, 3, 3, 0, 0, 3, 3, 20, 127, 127, 20, 20, 127, 127, 20, 36, 46, 107,
    107, 58, 18, 99, 51, 24, 12, 102, 99, 50, 127, 77, 77, 119, 114, 80, 4, 6,
    3, 1, 28, 62, 99, 65, 65, 99, 62, 28, 8, 42, 62, 28, 28, 62, 42, 8, 8, 8,
    62, 62, 8, 8, 128, 224, 96, 8, 8, 8, 8, 8, 8, 96, 96, 64, 96, 48, 24, 12,
    6, 2, 62, 127, 73, 69, 127, 62, 64, 68, 127, 127, 64, 64, 98, 115, 81, 73,
    79, 70, 34, 99, 73, 73, 127, 54, 24, 24, 20, 22, 127, 127, 16, 39, 103, 69,
    69, 125, 57, 62, 127, 73, 73, 123, 50, 3, 3, 121, 125, 7, 3, 54, 127, 73,
    73, 127, 54, 38, 111, 73, 73, 127, 62, 99, 99, 128, 227, 99, 8, 28, 54, 99,
    65, 65, 20, 20, 20, 20, 20, 20, 65, 65, 99, 54, 28, 8, 2, 3, 81, 89, 15, 6,
    62, 127, 65, 77, 79, 46, 124, 126, 11, 11, 126, 124, 127, 127, 73, 73, 127,
    54, 62, 127, 65, 65, 99, 34, 127, 127, 65, 99, 62, 28, 127, 127, 73, 73,
    65, 65, 127, 127, 9, 9, 1, 1, 62, 127, 65, 73, 123, 58, 127, 127, 8, 8,
    127, 127, 65, 127, 127, 65, 32, 96, 65, 127, 63, 1, 127, 127, 28, 54, 99,
    65, 127, 127, 64, 64, 64, 64, 127, 127, 6, 12, 6, 127, 127, 127, 127, 14,
    28, 127, 127, 62, 127, 65, 65, 127, 62, 127, 127, 9, 9, 15, 6, 30, 63, 33,
    97, 127, 94, 127, 127, 25, 57, 111, 70, 38, 111, 73, 73, 123, 50, 1, 1,
    127, 127, 1, 1, 63, 127, 64, 64, 127, 63, 31, 63, 96, 96, 63, 31, 127, 127,
    48, 24, 48, 127, 127, 99, 119, 28, 28, 119, 99, 7, 15, 120, 120, 15, 7, 97,
    113, 89, 77, 71, 67, 127, 127, 65, 65, 2, 6, 12, 24, 48, 96, 64, 65, 65,
    127, 127, 4, 6, 127, 127, 6, 4, 64, 64, 64, 64, 64, 64, 64, 64, 1, 3, 6, 4,
    32, 116, 84, 84, 124, 120, 126, 126, 72, 72, 120, 48, 56, 124, 68, 68, 68,
    48, 120, 72, 72, 126, 126, 56, 124, 84, 84, 92, 24, 8, 124, 126, 10, 10,
Ejemplo n.º 5
0
loop1 = 0  # numero de voltas do carro 1
loop2 = 0  # carro 2

loop_max = 5  # Maximo de voltas da corrida

ACEL = 0.2  # aceleracao base
FRICTION = 0.01  # friccao (reducao da aceleracao)
kf = 1.5  # constante de reducao da fricçao

flag_sw1 = 0  # Flag para saber se o acel do Carro 1 foi apertado
flag_sw2 = 0  # carro 2

pinoFita = Pin(0,
               Pin.OUT)  # Pino 0 - D3 NodeMCU para conectar os leds NeoPixels
track = NeoPixel(pinoFita, NPIXELS)  # Cria a fita de led com 300 pixels
PIN_P1 = Pin(4, Pin.IN, Pin.PULL_UP)  # d2 botao para acelerar o carro 1
PIN_P2 = Pin(5, Pin.IN, Pin.PULL_UP)  # d1 botao para acelerar o carro 2
pin = Pin(2, Pin.OUT)

while True:
    if flag_sw1 == 1 and PIN_P1.value() == 0:
        flag_sw1 = 0  # para contar pressionou tem que mudar de 1 para 0
        speed1 = speed1 + ACEL  # se vc pressionou, aumenta a velocidade

    if flag_sw1 == 0 and PIN_P1.value() == 1:
        flag_sw1 = 1  # Prepara o botao, agora esta desapertado

    speed1 = speed1 - 2 * FRICTION * speed1 * kf
    if speed1 < 0:
        speed1 = 0
Ejemplo n.º 6
0
from config import *

from restapi import RestApi

sta_if = network.WLAN(network.STA_IF)
epoch_offset = 946684800

## sgp30 setup
i2c = SoftI2C(scl=Pin(device_config['scl']),
              sda=Pin(device_config['sda']),
              freq=100000)
sgp30 = SGP30(i2c)
sgp30.initialise_indoor_air_quality()

## neopixel
np = NeoPixel(Pin(device_config['led']), 1)

if app_config['audio']:
    ## audio setup
    SAMPLES_PER_SECOND = 11025

    audio_out = I2S(I2S.NUM0,
                    bck=Pin(device_config['bck']),
                    ws=Pin(device_config['ws']),
                    sdout=Pin(device_config['sdout']),
                    standard=I2S.PHILIPS,
                    mode=I2S.MASTER_TX,
                    dataformat=I2S.B16,
                    channelformat=I2S.ONLY_RIGHT,
                    samplerate=SAMPLES_PER_SECOND,
                    apllrate=0,
Ejemplo n.º 7
0
from machine import Pin
from neopixel import NeoPixel
from time import sleep

NUM_LEDS = 8

# this goes to data pin
datapin = Pin(18, Pin.OUT)  # XXX check num

np = NeoPixel(datapin, NUM_LEDS)

RED = (10, 0, 0)
YELLOW = (10, 4, 0)
GREEN = (0, 10, 0)
OFF = (0, 0, 0)

TIME_REGULAR = 7
TIME_YELLOW = 2

np[2] = OFF
np[1] = OFF
np[0] = OFF

while True:
    np[2] = RED
    np[1] = OFF
    np.write()
    sleep(TIME_REGULAR)

    np[1] = YELLOW
    np.write()
Ejemplo n.º 8
0

# display
if 60 in i2c.scan():
    oled = OLED()
    display = oled

# 3 axis accelerometer
accelerometer = Accelerometer()

# bm280
if 119 in i2c.scan():
    bme280 = BME280()

# 3 rgb leds
rgb = NeoPixel(Pin(17, Pin.OUT), 3, 3, 1, brightness=0.3)
rgb.write()

# light sensor
light = ADC(Pin(39))
light.atten(light.ATTN_11DB)

# sound sensor
sound = ADC(Pin(36))
sound.atten(sound.ATTN_11DB)

# buttons
button_a = Pin(0, Pin.IN, Pin.PULL_UP)
button_b = Pin(2, Pin.IN, Pin.PULL_UP)

# touchpad
Ejemplo n.º 9
0
pin0 = Pin(0, Pin.OUT)               # set GPIO0 to output to drive NeoPixels
pin2 = Pin(2, Pin.IN, Pin.PULL_UP)   # set GPIO12 as input with pullup
button = Signal(pin2, invert=True)   # let's use Signals, eh?
pressed = False
brightness = 128

# Change these to match your unique identifiers
# - wifi 
SSID = 'FooBar'
Password = '******'
# - io.adafruit.com 
X_AIO_Key = '4f50c52123232312334ac7582c63ed'
User = '******'
Feed = 'Feed-Name'

np = NeoPixel(pin0, 1) 
np[0] = (0,0, brightness)
np.write()

def LED(r, g, b):
	np[0] = (r,g,b)
	np.write()

def do_connect():
	wlan = network.WLAN(network.STA_IF) 
	wlan.active(True)
	if not wlan.isconnected():
		print('Connecting to Network...')
		wlan.connect(SSID, Password)
		while not wlan.isconnected():
			pass
Ejemplo n.º 10
0
SLEEP_TIME = 10
PULSE_TIME = 0.15
HOST = 'peaceful-wildwood-66302.herokuapp.com'
USERNAME = '******'
BRIGHTNESS = 7  # 0-255
PULSE_BRIGHTNESS = 32  # 0-255; > BRIGHTNESS

# Calculated constants
PATH = USERNAME + '/' if USERNAME else ''
PULSE_SLEEP_TIME = PULSE_TIME / (2 * (PULSE_BRIGHTNESS - BRIGHTNESS))

try:
    from machine import Pin
    from neopixel import NeoPixel
    pin = Pin(PIN_NUM, Pin.OUT)
    np = NeoPixel(pin, NUM_LEDS)
except ImportError:
    # a real computer, no HW access

    class FakeNeoPixel(list):
        def __init__(self):
            super()
            for led in range(NUM_LEDS):
                self.append((0, 0, 0))

        def write(self):
            print(' '.join('{}'.format(c) for c in self))

    np = FakeNeoPixel()

Ejemplo n.º 11
0
#octopusLAB - ESP32 - WS RGB LED (Neopixel)

from time import sleep
from machine import Pin
from neopixel import NeoPixel

BUILT_IN_LED = 2
PIN_WS = 13
POCET_LED = 1
pin= Pin(PIN_WS, Pin.OUT)
np = NeoPixel(pin, POCET_LED)

pin_led = Pin(BUILT_IN_LED, Pin.OUT)

def simple_blink():
    pin_led.value(0)
    sleep(1/2)
    pin_led.value(1)
    sleep(1/2)

while True:
    np[0] = (128, 0, 0)
    np.write()
    simple_blink() 
    
    np[0] = (0,128, 0)
    np.write()
    simple_blink() 
    
    np[0] = (0, 0, 128)
    np.write()
Ejemplo n.º 12
0
try:
    from audioio import AudioOut
except ImportError:
    try:
        from audiopwmio import PWMAudioOut as AudioOut
    except ImportError:
        pass  # not always supported by every board!

# color rgb values
OFF = (0, 0, 0)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)

# neopixels
pixels = NeoPixel(board.NEOPIXEL, 10, brightness=0.2)

# red LED
led = DigitalInOut(board.D13)
led.switch_to_output()

# face button 1 (left)
button_1 = DigitalInOut(board.BUTTON_A)
button_1.switch_to_input(pull=Pull.DOWN)

# feed button
button_feed = DigitalInOut(board.A1)
button_feed.direction = Direction.INPUT
button_feed.pull = Pull.UP

# motor controller
Ejemplo n.º 13
0
oled = OLED()

# 3 axis accelerometer
accelerometer = Accelerometer()
motion = Motion()

# Magnetic
if 48 in i2c.scan():
    magnetic = Magnetic()

# # bm280
# # if 119 in i2c.scan():
# #     bme280 = BME280()

# 3 rgb leds
rgb = NeoPixel(Pin(27, Pin.OUT), 8, 3, 1)
rgb.write()

# light sensor
light_L = ADC(Pin(39))
light_L.atten(light_L.ATTN_11DB)
light_R = ADC(Pin(36))
light_R.atten(light_R.ATTN_11DB)

# # # sound sensor
# # sound = ADC(Pin(36))
# # sound.atten(sound.ATTN_11DB)

# wakeup pin
pin_wakeup = MPythonPin(0, PinMode.OUT)  # p0
pin_wakeup.write_digital(1)  # 3v3 enable
Ejemplo n.º 14
0
 def __init__(self, pinNumber, ledCount):
     self.np = NeoPixel(Pin(pinNumber), ledCount)
     self.ledCount = ledCount
     self.rFunc = self.NULL_FUNCTION
     self.gFunc = self.NULL_FUNCTION
     self.bFunc = self.NULL_FUNCTION
Ejemplo n.º 15
0
from machine import Pin
from neopixel import NeoPixel
import time

from colours import hsv_to_rgb

pin = Pin(12, Pin.OUT)
np = NeoPixel(pin, 20)

led = Pin(5, Pin.OUT)
led.off()

NUM_PIXELS = 20 - 1
# NUM_PIXELS = 1


def float_to_byte(value: float):
    return round(value * 255)


def rainbow():
    for firstPixelHue in range(0, 255):
        for pixel in range(0, NUM_PIXELS):
            pixelHue = firstPixelHue + (pixel * 255 / NUM_PIXELS)
            color = hsv_to_rgb(pixelHue / 255, 1, 0.5)
            np[pixel] = (float_to_byte(color[0]), float_to_byte(color[1]),
                         float_to_byte(color[2]))
        np.write()
        time.sleep_ms(10)
        print('pixels:', np)
    return
Ejemplo n.º 16
0
from machine import Pin
from neopixel import NeoPixel

# --- rgb led --- #
# the number 12 is number of led
rgb_led = NeoPixel(Pin(5), 12)  # (D1) overnight RGB LED
lpd_uv = Pin(5, Pin.OUT, Pin.PULL_UP)  # (D1) UV light
lpd_uva = Pin(5, Pin.OUT, Pin.PULL_UP)  # (D1) UVA-B light
lpd_day = Pin(5, Pin.OUT, Pin.PULL_UP)  # (D1) day heat lamp
lpd_night = Pin(5, Pin.OUT, Pin.PULL_UP)  # (D1) night heat lamp


def clear():
    for i in range(12):
        rgb_led[i] = (0, 0, 0)
        rgb_led.write()


def cockcrow():
    sunrise = 64, 35, 0
    for i in range(4 * 12):
        for j in range(12):
            rgb_led[j] = sunrise
        rgb_led.write()


def cock_shut():
    sunset = 128, 88, 0
    for i in range(4 * 12):
        for j in range(12):
            rgb_led[j] = sunset
Ejemplo n.º 17
0
    def get_pressed(self):
        # Call this after read_pads()
        return self.pressed

    def get_led(self):
        global leds
        return leds[self.led_id]

    def set_led(self, color):
        global leds
        leds[self.led_id] = color


players = [Player(x, COLORS4[i]) for i, x in enumerate(PLAYER_PINS)]
buttons = [Button(x, i) for i, x in enumerate(BUTTON_PINS)]
leds = NeoPixel(Pin(NP_LED, Pin.OUT), NUM_BUTTONS)
level = Pin(LVL, Pin.OUT, value=1)


def clear_leds():
    global leds
    for b in buttons:
        b.set_led((0, 0, 0))
    leds.write()


def rainbow():
    global leds
    for i, b in enumerate(buttons):
        b.set_led(COLORS8[i])
    leds.write()
Ejemplo n.º 18
0
 def __init__(self, pin, num=1):
     self.pin = pin
     self.num = num
     self.np = NeoPixel(Pin(self.pin, Pin.OUT), self.num)
Ejemplo n.º 19
0
The buzzer buzzes at random time and the players try to press their
buttons as fast as possible. Who is first wins a point. If the button
is pressed too soon and last point belongs to the same player,
she loses the point.

To restart the game just press reset on the board.
"""

butt_1 = Pin(2, Pin.OUT)
butt_1.value(1)
butt_2 = Pin(4, Pin.OUT)
butt_2.value(1)

leds = Pin(5, Pin.OUT)
LEDS = 8
np = NeoPixel(leds, LEDS)
for one in range(LEDS):
    np[one] = (0, 0, 0)
np.write()

buzz_timer = Timer(-1)

rand_sleep = 3000
butt_1_pressed = False
butt_2_pressed = False
timer_running = True
player_1_color = (25, 155, 15)
player_2_color = (155, 25, 80)  # (155, 25, 15)
current_round = 0
MAX_ROUNDS = 7
Ejemplo n.º 20
0
 def __init__(self, config):
     self.num_pixels = 64
     self.np = NeoPixel(Pin(13), self.num_pixels)
     self.enable_auto_time = False
Ejemplo n.º 21
0
from machine import Pin
from neopixel import NeoPixel
from utime import sleep

NEOPIXEL_PIN = 0
NUMBER_PIXELS = 16
strip = NeoPixel(machine.Pin(NEOPIXEL_PIN), NUMBER_PIXELS)

def wheel(pos):
    # Input a value 0 to 255 to get a color value.
    # The colors are a transition r - g - b - back to r.
    if pos < 0 or pos > 255:
        return (0, 0, 0)
    if pos < 85:
        return (255 - pos * 3, pos * 3, 0)
    if pos < 170:
        pos -= 85
        return (0, 255 - pos * 3, pos * 3)
    pos -= 170
    return (pos * 3, 0, 255 - pos * 3)

counter = 0
while True:
    for i in range(0, NUMBER_PIXELS):
        strip[i] = wheel(counter % 255)
        strip.write()
        counter += 10
        sleep(.1)
Ejemplo n.º 22
0
    if error:
        print('Revert to default code')
        network.log('Revert to default code')
        gc.collect()
        print(gc.mem_free())
        try:
            while True:
                network.process()
                time.sleep_ms(100)
        except:
            pass  #machine.reset()


config_btn = Pin(CONFIG_PIN, Pin.IN)

status_led = NeoPixel(Pin(LED_PIN, Pin.OUT), 1, timing=True)

if config_btn.value():
    print('config button is pressed')
    # turn on config led
    status_led.fill((255, 0, 0))
    status_led.write()

    # start while loop until btn is released
    press_begin = time.ticks_ms()
    press_duration = 0
    while config_btn.value():
        press_end = time.ticks_ms()
        press_duration = time.ticks_diff(press_end, press_begin)
        print(press_duration)
        if press_duration > 2000:
Ejemplo n.º 23
0
from time import sleep
from random import choice, randint
from Classes import Player
from os import system
from json import load

colors = {
    'Game': (50, 40, 30),
    'Black': (0, 0, 0),
    'Wrong': (50, 255, 255),
    'Goto': (0, 255, 255),
    'Start': (200, 200, 200)
}

led_count = 16
pixels = NeoPixel(D18, led_count, auto_write=True)


def setup():
    global total_players, player_names, led_count, pixels, i, colors, p1, p2,\
                p3, p4, switch, neigh_in_use
    total_players = 0
    player_names = []
    neigh_in_use = []  # used in dices in order not to cause threading errors

    i = 0
    pname = ''
    while total_players < 2 or total_players > 4:
        total_players = int(input("Колко играча ще играете? - "))

    stlives = 0
Ejemplo n.º 24
0
from machine import Pin
from neopixel import NeoPixel
import time

pin = Pin(14, Pin.OUT)  # output to drive NeoPixels
np = NeoPixel(pin, 64)  # create NeoPixel driver on GPIO0 for 8 pixels


def blink_pixel(r, g, b, p):
    global np
    np[p] = (r, g, b)
    np.write()
    time.sleep_ms(20)
    np[p] = (0, 0, 0)
    np.write()


def blink(r, g, b):
    global np
    for i in range(63):
        blink_pixel(r, g, b, i)
Ejemplo n.º 25
0
# Include wifi
from WiFiConnect import WiFiConnect

# Remember set SSID and password in WiFiConfig.py file
import WiFiConfig

# Import OctopusLab Robot board definition file
import octopus_robot_board as o # octopusLab main library - "o" < octopus

# Warning: RobotBoard version 1 use different WS Pin 13 !
pin_ws = Pin(13, Pin.OUT)

# Robot Board v2 (and newer)
# pin_ws = Pin(o.WS_LED_PIN, Pin.OUT)

np = NeoPixel(pin_ws, 1)

pin_led = Pin(o.BUILT_IN_LED, Pin.OUT)


def simple_blink():
    pin_led.value(0)
    sleep(0.1)
    pin_led.value(1)
    sleep(0.1)


# Default WS led light RED as init
np[0] = (128, 0, 0)
np.write()
simple_blink()
Ejemplo n.º 26
0
 def __init__(self):
     self._np = NeoPixel(Pin(5, Pin.OUT), 9)
Ejemplo n.º 27
0
from neopixel import NeoPixel
import machine
import time

np = NeoPixel(machine.Pin(4),1)

for r in range(255):
  for g in range(255):
    for b in range(255):
      np[0]=((r,g,b))
      np.write()
      time.sleep_ms(10)
      

Ejemplo n.º 28
0

colors = [
    (255, 40, 192),  # pink
    (255, 32, 0),  # orange
    (80, 0, 255),  # violet
    (255, 0, 0),
    (0, 255, 0),
    (0, 0, 255),
    (255, 128, 0),  # yellow
    (0, 255, 128),  # cyan
    (255, 0, 64),  # magenta
    (127, 127, 127),  # white
]

strip = NeoPixel(Pin(LED_PIN, Pin.OUT), LED_COUNT)


# Main program logic follows:
def main():
    global colors, strip

    while True:
        print('Color wipe animations.')
        for n in range(3):
            for c in colors:
                #colorWipe(strip, c)
                pass
        # print ('Theater chase animations.')
        # for n in range(0):
        #     theaterChase(strip, random.choice(colors))
Ejemplo n.º 29
0
from machine import Pin, PWM
from neopixel import NeoPixel
import random
import time
from config import param_data

pin = Pin(22, Pin.OUT)
np = NeoPixel(pin, 30)
s1 = PWM(Pin(18), freq=50, duty=0)
value = Pin(11, Pin.OUT)
autoflag = param_data.get('autoflay')
value_time = param_data.get('valuetime')
value_delay = param_data.get('valuedelay')
water_level = param_data.get('WaterLevel')
'''
自动参数
水泵延时valuedelay
抽水时间valuetime
抽水间隔valueinterval
喷雾延时fogdelay
加热温度

'''


def color_buf(mode, delay=0):
    if mode == 'on':
        for i in range(30):
            r = random.randint(0, 255)
            g = random.randint(0, 255)
            b = random.randint(0, 255)
Ejemplo n.º 30
0
        return super().read() * 1.1 / 4095 / 6.81 / 0.011
    
'''

# buzz
buzz = Buzz()

# display
oled = OLED()
display = oled

# 3 axis accelerometer
accelerometer = Accelerometer()

# 3 rgb leds
rgb = NeoPixel(Pin(17, Pin.OUT), 3, 3, 1)
rgb.write()

# light sensor
light = ADC(Pin(39))

# sound sensor
sound = ADC(Pin(36))

# buttons
button_a = Pin(0, Pin.IN, Pin.PULL_UP)
button_b = Pin(2, Pin.IN, Pin.PULL_UP)

# touchpad
touchPad_P = TouchPad(Pin(27))
touchPad_Y = TouchPad(Pin(14))