trodland

microbit.py

Sep 19th, 2020
1,098
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Krever biblioteket pyserial (ofte automatisk inkludert i IDE'er)
  2. import serial
  3.  
  4. def kobling(com):
  5.     try:
  6.         return serial.Serial(com, 115200, timeout=1)
  7.     except:
  8.         print("Finner ikke microbit på den porten")
  9.        
  10.  
  11. def lesData(ser):
  12.     rcv = ser.readline()
  13.     return(rcv.decode('utf-8').rstrip())
  14.  
RAW Paste Data