def __init__(self): self.black = machine.TouchPad(machine.Pin(PINBLACK)) self.white = machine.TouchPad(machine.Pin(PINWHITE)) self.mode = machine.TouchPad(machine.Pin(PINMODE)) print(PINMODE,PINWHITE,PINBLACK) #self.black.config(SENSITIVITY) #self.white.config(SENSITIVITY) #self.mode.config(SENSITIVITY) self.b = 0 self.w = 0 self.m = 0 self.last_pause_time = utime.ticks_ms()
def ex2(): """ Pipe 1:1 reuse - read 3 sensors and update 3 leds, using the same pipe definition. """ update = lambda pin, g: (pin.duty(value * 1023) for value in g) pipe = lambda pin, sensor: update(pin, g=normalize(max=1023, g=poll(sensor))) touches = (machine.TouchPad(machine.Pin(n)) for n in (13, 12, 14)) leds = (machine.TouchPad(machine.Pin(n)) for n in (5, 18, 19)) pipes = (pipe(leds[i], touches[i]) for i in range(len(touches))) # for pipe in pipes: # consume(pipe) # FIXME: this is blocking: use a machine.Timer or threading ? for pipe in pipes: for _ in pipe: pass # FIXME: if one element of the pipe blocks, then everything blocks.
def make_pipes(nmin=0, nmax=650, delta=0, onchange=True, n=None): global Changed # wtf ? touches = [machine.TouchPad(machine.Pin(n)) for n in (13, 12, 14)] leds = [machine.PWM(machine.Pin(n)) for n in (5, 18, 19)] read = lambda touch: (touch.read() for _ in itertools.repeat(None) ) # oneliner infinite generator normalize = lambda g, min=0, max=1023: ( (value - min) / (max - min) for value in g) clamp = lambda g, min_=0, max_=1: (max(min(max_, value), min_) for value in g) apply = lambda g, pwm: (pwm.duty(int(value * 1023)) or value for value in g) if not onchange: Changed = lambda g, delta=None: (v for v in g) # neutralize Changed pipes = [ apply( pwm=leds[i], #g=Changed(delta=delta, g=clamp(normalize(min=nmin, max=nmax, g=read(touches[i])))) #) for i in range(n or len(touches)) ] return pipes
def __init__(self, pin, on_pressed, threshold=400, debounce_ms=50): self._touchpad = machine.TouchPad(pin) self._on_pressed = on_pressed self._threshold = threshold self._debounce_ms = debounce_ms self._down_ms = None self._pressed = False
def ex5(): """ Pipe 1:1 advances - read 1 sensor continuously at a high rate and send information to a REST service. """ import urequests # read sensor at high rate touch = machine.TouchPad(machine.Pin(4)) pipe_read = average(touch) g = consume(pipe_read, period=0.1) # send information to REST service publish = lambda g: (urequests.put('http://httpbin.com/anything/somevalue', data=dict(value=value)) for value in g) pipe_publish = publish(onchange(g, delta=1)) g = consume(pipe_publish, period=1) """ # or a one-liner - re-using created pipes pipe_read = lambda g: average(g) # to be reusable, pipes need to be a generator function pipe_publish = lambda g: publish(onchange(g, delta=1)) g = consume(consume(pipe_publish(consume(period=0.1, g=pipe_read(touch))))) # or a one-liner - fully declarative oneliner, no pipe reuse g = consume(period=1, g=consume(publish(onchange(delta=1, g=consume(period=0.1, g=average(touch)))))) """ # optionnally log pipe output g = published_values # it is what is is, actually while value in published_values: print('Sent REST message:', value)
def __init__(self, pin:int): super().__init__() self.pin = pin self.touch = machine.TouchPad(machine.Pin(pin)) self.last_touched = 0 self.threshold = 500 self.debounce = 3/10 self.poll = 1/10
def __init__(self, data_cb=None, enable_eyes=False, enable_buzzer=False, enable_accelero=False): self.id = machine.nvs_getstr('token') self.wifi_ssid = machine.nvs_getstr('ssid') self.wifi_password = machine.nvs_getstr('pwd') self.mqtt_server = machine.nvs_getstr('mqtt_server') self.mqtt_user = machine.nvs_getstr('mqtt_user') self.mqtt_password = machine.nvs_getstr('mqtt_password') self.wifi = network.WLAN(network.STA_IF) self.mqtt = network.mqtt(self.id, self.mqtt_server, user=self.mqtt_user, password=self.mqtt_password, cleansession=True, data_cb=data_cb) self.button_0 = Button(machine.Pin(36)) self.button_1 = Button(machine.Pin(39)) self.touch_0 = machine.TouchPad(machine.Pin(12)) self.touch_1 = machine.TouchPad(machine.Pin(14)) i2c_bus = machine.I2C(id=0, scl=machine.Pin(22), sda=machine.Pin(21), freq=100000) if enable_eyes: self.eyes = Eyes() print(Feedback.INF_EYES_ENABLED) if enable_buzzer: self.buzzer = Buzzer() print(Feedback.INF_BUZZER_ENABLED) if enable_accelero: self.accelero = AcceleroMeter(i2c_bus) print(Feedback.INF_ACCELERO_ENABLED)
def ex1(): """ Pipe 1:1 - read 1 sensor and update 1 led. """ touch = machine.TouchPad(machine.Pin(4)) led = machine.Pin(2, machine.Pin.OUT) # onboard led update = lambda pin, g: (pin.on() if value else pin.off() for value in g) pipe = update( led, debug(g=boolean(threshold=0.3, g=normalize(max=1023, g=poll(touch))))) for _ in pipe: pass
def __init__(self, pin, callback, *args, **kwargs): self.pin = machine.Pin(pin) self.touchpin = machine.TouchPad(self.pin) self.callback = callback self.avg_count = 15 self.samplerate = 120 self.threshold = 0.95 self.debounce_ms = 300 self.sample_sleep_ms = int(1000 / self.samplerate) self.readings = [] self.configure(kwargs) self.callback_triggered_last = utime.ticks_ms() # Initial calibration for i in range(self.avg_count): utime.sleep_ms(self.sample_sleep_ms) self.readings.append(self.touchpin.read())
def __init__(self, pin: int, threshold: int, on_action=None, off_action=None, toggle_state_on_func=None, action=None, toggle=True): self.pin = pin self.THRESHOLD = threshold self.on_action = on_action self.off_action = off_action self.toggle_state_on_func = toggle_state_on_func self.action = action self.toggle = toggle self.loop = asyncio.get_event_loop() self.TOUCH = machine.TouchPad(machine.Pin(self.pin)) self.listen_for_touch()
def goto_deepsleep(): #go to deepsleep wait for user to press one of the buttons #button1 = machine.TouchPad(machine.Pin(33)) #time.sleep_ms(100) #reading = button1.read() #button1.config(int(2/3 * reading)) #button1.callback(lambda t:print("Pressed 33")) #button2 = machine.TouchPad(machine.Pin(12)) #time.sleep_ms(100) #reading = button2.read() #button2.config(int(2/3 * reading)) #button2.callback(lambda t:print("Pressed 12")) button3 = machine.TouchPad(machine.Pin(32)) time.sleep_ms(100) reading = button3.read() button3.config(int(2 / 3 * reading)) button3.callback(lambda t: print("Pressed 32")) print("Sleepytime.. zz") time.sleep(1) machine.deepsleep()
def getAvgTouchValue(self, pin, total, interval): # verify that total and interval are valid if total > interval: if (total % interval) == 0: measurements = total / interval else: measurements = (total / interval) + 1 # accessing touchpad pin touch = machine.TouchPad(machine.Pin(pin)) sum_touchvalues = 0 sum_measurements = measurements while measurements > 0: touchvalue = touch.read() sum_touchvalues += touchvalue time.sleep(interval / 1000) measurements -= 1 return math.floor(sum_touchvalues / sum_measurements)
def get_touch_pins_value(): values = [] for touch_pin_number in touch_pin_list: values.append(machine.TouchPad(machine.Pin(touch_pin_number)).read()) print("(pass get_touch_pins_value: " + str(values) + ")")
def wait_touch_pin_pressed(index): touch_pin_number = touch_pin_list[index] touch_pin = machine.TouchPad(machine.Pin(touch_pin_number)) while touch_pin.read() > 200: sleep_ms(50) print("(pass wait_touch_pin_pressed)")
# if msg == b"on": #led.value(1) # led_flashing = 1 #elif msg["state"]["reported"]["status"] == 0: #led.value(0) # temp = d.temperature() # humidity = d.humidity() client.publish(topic=b"temp", msg=str(temp)) client.publish(topic=b"humidity", msg=str(humidity)) # elif msg != b"on": # led_flashing = 0 led = machine.Pin(LED_PIN, machine.Pin.OUT, value=1) touch = machine.TouchPad(machine.Pin(TOUCH_PIN)) client = MQTTClient(CLIENT_ID, SERVER, keepalive=KEEPALIVE) client.DEBUG = True client.settimeout = settimeout client.set_callback(sub_cb) #client.connect() #client.subscribe(TOPIC, qos=1) print("Connected to %s, subscribed to %s topic" % (SERVER, TOPIC)) try: while 1: if not connected: client.connect()
if (likes_count > prev_likes_count) and (prev_likes_count > 0) : set_arrivals_led_on() prev_likes_count = likes_count def intr_handler_timer0(t): update_likes_led() init_led() prev_likes_count = 0 wifi = connect_wifi(SSID_NAME, SSID_PASS) if not wifi: sys.exit(0) update_likes_led() t0 = machine.Timer(0) t0.init(period=900000, mode=machine.Timer.PERIODIC, callback=intr_handler_timer0) tp = machine.TouchPad(machine.Pin(13)) while True: utime.sleep(0.1) value = tp.read() if value < 400: print('touched') set_arrivals_led_off()
from webserve_funcs import recpostsave from webserve_funcs import servemessage from webserve_funcs import convertsavepostfile from websocket_funcs import make_hybi07_header from websocket_funcs import servewebsocket from ms5611 import GetMS5611calibrations, MS5611convert, ams5611read from ds3231 import rtctojsepoch, jsepochtoisodate import machine, array i2c = machine.I2C(scl=machine.Pin(5), sda=machine.Pin(4)) greenpin = machine.PWM(machine.Pin(13), freq=1024, duty=40) touchpin = machine.TouchPad(machine.Pin(33)) jsepochoffset = rtctojsepoch(i2c, busywaitsec=True) - time.ticks_ms() log(jsepochtoisodate(jsepochoffset)) # enable the wifi only if entry is held down on startup ipnumber = "" for i in range(10): if touchpin.read() > 1100: break greenpin.duty(500 if ((i % 2) == 0) else 0) time.sleep_ms(200) touchpin.read() else: # this should be deferred or made on-off for i in range(20):
def __init__(self, Dobby, Name, Config): # Referance to dobby self.Dobby = Dobby # Variable to indicate of the configuration of the Touch went ok ## False = Error/Unconfigured ## True = Running self.OK = False # Name - Referance name self.Name = str(Name) # Log Event self.Dobby.Log(0, "Touch/" + self.Name, "Initializing") # Check if we got the needed config for Entry in ['Pin']: if Config.get(Entry, None) == None: self.Dobby.Log( 2, "Touch/" + Name, "Missing config: " + Entry + " - Unable to initialize Touch") return # Save pin name to self.Pin self.Pin = Config['Pin'] # Reset the pin try: self.Dobby.Pin_Monitor.Reserve(self.Pin, "Touch-" + self.Name) except self.Dobby.Pin_Monitor.Error as e: # Pin in use unable to configure Touch self.Dobby.Log(2, "Touch/" + Name, "Pin in use - Unable to initialize Touch") # return so we dont set State to true aka mark the Touch as configured return # Convert Wemos Pin to GPIO Pin Number # its a valid pin if we get to herer, check done during reserve self.Pin = self.Dobby.Pin_Monitor.To_GPIO_Pin(Config['Pin']) # if we get a value error its not a pin we can use for touch # Create TouchPad pin try: self.Pin = machine.TouchPad(machine.Pin(self.Pin)) except ValueError: # Pin not a touch pin unable to configure Touch self.Dobby.Log( 2, "Touch/" + Name, "Pin not usable for touch - Unable to initialize Touch") # return so we dont set State to true aka mark the Touch as configured return # Save trigger at if given # default to 50 self.Trigger_At = Config.get('Trigger At', 50) # Reset to default if we didnt get int if type(self.Trigger_At) != int: self.Trigger_At = 50 # Log event self.Dobby.Log(0, "Touch/" + self.Name, "Trigger at set to " + str(self.Trigger_At)) self.Block_Action = 750 self.Last_Action = utime.ticks_ms() # Used if hold is configured self.Hold = {} # # Store hold timers if set # # if not default to specified values # self.Hold_After = Config.get('Hold After', 500) # self.Hold_Delay = Config.get('Hold Delay', 150) # self.Hold_Pressed = None # self.Hold_Up = True # MQTT Message self.MQTT_Message = {} if Config.get("Message", None) != None: # For loop over entries in Messages if any for Entry in Config['Message']: # Bool value to check if either topic or payload failed Failure = False # Check if we got both Topic and Payload for Check in ['Topic', 'Payload']: if Failure == True: continue # Missing topic or payload if Config['Message'][Entry].get(Check, None) == None: # Log event self.Dobby.Log( 2, "Touch/" + self.Name, "Trigger Message " + Entry + ": Missing " + Check + " - Disabling the '" + Entry + "' message") # break since one is missing and we need both topic and payload Failure = True # Check if we failed to get the needed settings if Failure == False: # Save settings self.MQTT_Message[ Entry.lower()] = Config['Message'][Entry] # log event self.Dobby.Log( 0, "Touch/" + self.Name, "Trigger Message " + Entry + " set to Topic: '" + self.MQTT_Message[Entry.lower()]['Topic'] + "' Payload: '" + self.MQTT_Message[Entry.lower()]['Payload'] + "'") # //////////////////////////////////////// Relay \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ self.Relay = {} if Config.get("Relay", None) != None: # For loop over On/Off to check for both messages for Entry in Config['Relay']: # Bool value to check if either topic or payload failed Failure = False # Check if we got both Topic and Payload for Check in ['Name', 'State']: if Failure == True: continue # Missing topic or payload if Config['Relay'][Entry].get(Check, None) == None: # Log event self.Dobby.Log( 2, "Touch/" + self.Name, "Trigger Relay " + Entry + ": Missing " + Check + " - Disabling the '" + Entry + "' message") # break since one is missing and we need both topic and payload Failure = True # Check if we failed to get the needed settings if Failure == False: # Save settings self.Relay[Entry.lower()] = Config['Relay'][Entry] # log event self.Dobby.Log( 0, "Touch/" + self.Name, Entry + ": Trigger Relay: '" + self.Relay[Entry.lower()]['Name'] + "' State: '" + self.Relay[Entry.lower()]['State'] + "'") # //////////////////////////////////////// Dimmer \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ self.Dimmer = {} if Config.get("Dimmer", None) != None: # For loop over On/Off to check for both messages for Entry in Config['Dimmer']: # Bool value to check if either topic or payload failed Failure = False # Check if we got both Topic and Payload for Check in ['Name', 'State']: if Failure == True: continue # Missing topic or payload if Config['Dimmer'][Entry].get(Check, None) == None: # Log event self.Dobby.Log( 2, "Touch/" + self.Name, "Trigger Dimmer " + Entry + ": Missing " + Check + " - Disabling the '" + Entry + "' message") # break since one is missing and we need both topic and payload Failure = True # Check if we failed to get the needed settings if Failure == False: # Save settings self.Dimmer[Entry.lower()] = Config['Dimmer'][Entry] if Entry.lower() == 'hold': # Log event self.Dobby.Log(0, "Touch/" + self.Name, "Hold enabeled") # Enable hold self.Hold_Enable() # log event self.Dobby.Log( 0, "Touch/" + self.Name, Entry + ": Trigger Dimmer: '" + self.Dimmer[Entry.lower()]['Name'] + "' State: '" + str(self.Dimmer[Entry.lower()]['State']) + "'") # Mark Touch as ok aka enable it self.OK = True # What the reading should be when we are not getting touched self.High = 0 # lets read 10 times over 100ms and get the Highest values for i in range(10): self.High = max(self.Pin.read(), self.High) # only sleep during the first 9 readings if i != 9: # Sleep for 10 ms utime.sleep_ms(10) # Log event self.Dobby.Log(0, "Touch/" + self.Name, "High set to: " + str(self.High)) # List to be used for averaging the self.Readings = [] # State of Touch - On/OFF aka True/False self.State = self.Get_State() # Log event self.Dobby.Log(0, "Touch/" + self.Name, "Initialization complete")
import uos import time import onewire import ds18x20 import network import esp import esp32 import ubinascii import ntptime import usgota import gc import ujson from umqtt_simple import MQTTClient machine.freq(80000000) esp.osdebug(None) touch = machine.TouchPad(machine.Pin(33)) touch.config(1000) esp32.wake_on_touch(True) adc_pin = machine.Pin(35) adc = machine.ADC(adc_pin) adc.atten(adc.ATTN_11DB) print(os.uname()) client_id = ubinascii.hexlify(machine.unique_id()) def setup(): global SSID global SSID_password global mqtt_server global user global password
import text PASSWORD_CHARS = ["2", "3", "4", "5"] PASSWORD_MASK = "*" SW = 240 SH = 320 CW = 16 CH = 16 OUTPUT_OPEN = 0 OUTPUT_CLOSE = 1 OUTPUT = machine.Pin(21, machine.Pin.OUT) OUTPUT.value(OUTPUT_CLOSE) PADS = [machine.TouchPad(machine.Pin(i)) for i in [4, 32, 33, 27]] KEYS = [machine.Pin(i, machine.Pin.IN) for i in [36, 39, 34, 35]] KEY_EVENT_HANDLER = [] password_len = len(PASSWORD) password_posX_array = [] password_input_array = [] key_last_state = [] #PADS, KEYS key_new_state = [] password_show = False flag_error = False
# # # Development mode. False means start read loop at boot # dev = True import machine from umqtt.simple import MQTTClient import config drumpad_id = config.id client = MQTTClient("drumpad-{}".format(config.id), "manatee.local") client.connect() # See wiki for pinout: https://github.com/jackosx/CAMP/wiki/ESP32-Hardware pad_sensors = [machine.TouchPad(machine.Pin(p)) for p in config.pad_pins] pads_touched = [False for p in pad_sensors] touch_thresh = config.threshold # For debugging. Allows dev to adjust touch_thresh in REPL def set_touch_thresh(new_thresh): global touch_thresh touch_thresh = new_thresh # Called when new pad tapped def strike(new_pad, velocity): print("STRIKE", new_pad, velocity) pads_touched[new_pad] = True
import machine, utime, _thread import wifi, animations, webSrv, songs # touch pins: 4, 0, 2, 15, 13, 12, 14, 27, 33, 32 # value error on 0, 2. 13, 4: 50% touch_pin = 15 touch = machine.TouchPad(machine.Pin(touch_pin)) touch_val = 1000 touch_threshold = 180 # ldr specific values ldr_pin = 36 ldr = machine.ADC(machine.Pin(ldr_pin)) # thread specific values _thread.replAcceptMsg(True) animation_thread = 100 wait_before_start_thread = 2000 sound_thread = 100 alarm_song = "Tetris" # alarm-clock specific values rtc = machine.RTC() timer = machine.Timer(1) # will become True if alarm is running so touch is used to disable alarm is_alarm_running = False # blink once to signalize that system's up animations.blink(count = 2, time_on=50)
from umqtt.simple import MQTTClient import machine import network import time SSID="Your WIFI SSID" #WIFI SSID PASSWORD="******" #WIFI PASS t1 = machine.TouchPad(machine.Pin(4)) #esp32 Touch0 SERVER = "XX9999.messaging.internetofthings.ibmcloud.com" #XX9999 is org-id PORT = 8883 #ssl port CLIENT_ID = "d:XX9999:XXTYPE:XXdeviceID" #XX9999=org-id ,XXTYPE=device type, XXdiviceID TOPIC = "iot-2/evt/XX9999/fmt/json" #XX9999 is org-id username='******' #kotei mqttpass='******' #device id touroku ji ni settei suru password c=None def connectWifi(ssid,passwd): global wlan wlan=network.WLAN(network.STA_IF) wlan.active(True) wlan.connect(ssid,passwd) while(wlan.ifconfig()[0]=='0.0.0.0'): time.sleep(10) try: print("start") connectWifi(SSID,PASSWORD) print("mqtt connecting...") c = MQTTClient(CLIENT_ID,SERVER,port = PORT, ssl = True, user=username, password=mqttpass)
import machine import time import esp32 import sys # rest angle rest = 70 # low D angle (pad 1) lowD = 100 # c# angle (pad 2) csharp = 40 # capa threshold cthres = 260 tp1 = machine.TouchPad(machine.Pin(33)) tp1.config(cthres) tp2 = machine.TouchPad(machine.Pin(14)) tp2.config(cthres) # esp32.wake_on_touch(True) servo = machine.PWM(machine.Pin(21)) servo.freq(50) servo.duty(rest) # time.sleep_ms(150) tp = None # 32 = +90° # 81 = 0° # 128 = -90° # Stop if pin 5 is grounded (allows pyrshell to take control over the board) stop = machine.Pin(5, machine.Pin.IN, machine.Pin.PULL_UP) if stop.value() == 0:
except NameError: print("const not defined") const = lambda x: x # define sensor type METHOD = "multipoint" # METHOD = "single" # define pins FULL_PIN = const(13) TOP_PIN = const(12) BOTTOM_PIN = const(14) LED_PIN = config.LED # setup inputs and outpus t_full = machine.TouchPad(machine.Pin(FULL_PIN)) t_top = machine.TouchPad(machine.Pin(TOP_PIN)) t_bottom = machine.TouchPad(machine.Pin(BOTTOM_PIN)) led = machine.Pin(LED_PIN, machine.Pin.OUT, value=1) # MQTT settings SERVERS = config.MQTT_SERVERS CLIENT_ID = uos.uname()[0].upper().encode('utf-8') + b"-" + ubinascii.hexlify( machine.unique_id()) BASE_TOPIC = b"hand-sanitiser-levels" SUBSCRIBE_TOPIC = BASE_TOPIC + b'/' + CLIENT_ID + b'/messages/#' settings = { 'led_status_blink': True, 'poll_interval': 5, # time in minutes 'polling_hours': { # hour of day
import neopixel from notes import * import random import esp32 pin13 = machine.Pin(13) pin16 = machine.Pin(16, machine.Pin.IN, machine.Pin.PULL_UP) speaker = machine.PWM(pin13) speaker.duty(0) current = 0 thresh = 500 colors = [(0, 0, 0), (0, 0, 0)] t0 = machine.TouchPad(machine.Pin(4)) t1 = machine.TouchPad(machine.Pin(15)) t2 = machine.TouchPad(machine.Pin(12)) t3 = machine.TouchPad(machine.Pin(14)) t0.config(thresh) t1.config(thresh) t2.config(thresh) t3.config(thresh) pins = [t0, t1, t2, t3] np = neopixel.NeoPixel(machine.Pin(25), 10) # np = neopixel.NeoPixel(machine.Pin(25), 10, bpp=4) hx = machine.Pin(27, machine.Pin.PULL_UP)
# bar chart ref - https://alexwlchan.net/2018/05/ascii-bar-charts/ import machine import time # define pins CAP_PIN = const(14) # define starting values min_value = 500 max_value = 800 bar_size = 25 # setup inputs and outpus t = machine.TouchPad(machine.Pin(CAP_PIN)) # main def run(): print("** Water Level Test **") try: print("press ctrl-c to stop") print("") while True: value = t.read() # adjust if new min/max value min_value = min(min_value, t) max_value = max(max_value, t)
def __init__(self, pin_num, trigger, buffersize=300): self.sensor = machine.TouchPad(machine.Pin(pin_num)) self.readings = RollingStats(n=buffersize, init_val=self.sensor.read()) self.threshold = trigger
import network import socket import machine import time wlan = network.WLAN() wlan.active(True) wlan.connect('my-ap', 'my-password') sock_listen = socket.socket() sock_listen.bind(('0.0.0.0', 9999)) sock_listen.listen(1) touch0 = machine.TouchPad(machine.Pin(4)) touch2 = machine.TouchPad(machine.Pin(2)) touch4 = machine.TouchPad(machine.Pin(13)) touch5 = machine.TouchPad(machine.Pin(12)) touch6 = machine.TouchPad(machine.Pin(14)) touch7 = machine.TouchPad(machine.Pin(27)) while True: try: sock, _ = sock_listen.accept() start_ticks = time.ticks_ms() while True: sock.write("%d %d %d %d %d %d %d\n" % ( time.ticks_diff(time.ticks_ms(), start_ticks), touch0.read(), touch2.read(), touch4.read(),
import machine as mc from time import sleep touch0 = mc.TouchPad(mc.Pin(33)) while True: sleep(0.1) print(touch0.read())