Selasa, 20 September 2022

Two Micropython Communication

 

Micropython Ke-1

import sys
import machine

led = machine.Pin(24, machine.Pin.OUT)

def led_on():
    led(1)

Micropython Ke-1
def led_off():
    led(0)


while True:
    # read a command from the host
    v = sys.stdin.readline().strip()

    # perform the requested action
    if v.lower() == "on":
        led_on()
    elif v.lower() == "off":
        led_off()


Micropython Ke-2


import serial
import time

# open a serial connection
s = serial.Serial("/dev/ttyACM0", 115200)

# blink the led
while True:
    s.write(b"on\n")
    time.sleep(1)
    s.write(b"off\n")
    time.sleep(1)
  

https://stackoverflow.com/questions/72151781/how-can-i-get-raspberry-pi-pico-to-communicate-with-pc-external-devices


BEST MODUL PICO
https://www.arducam.com/raspberry-pi-pico-tensorflow-lite-micro-person-detection-arducam/



Tidak ada komentar:

Posting Komentar