SHARE
TWEET

Untitled

a guest Jan 21st, 2020 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. UART.setup("UART1")
  2. with serial.Serial(port="/dev/ttyO1", baudrate=9600) as ser:
  3.     while True:
  4.         amount = server.recv(1024).decode()
  5.         data = ser.read().decode("ascii")
  6.         if sql.execute("select count(*) from klienci where klient =" + data) == 0:
  7.             sql.execute("insert into klienci values(" + data + "," + amount + ")")
  8.         elif sql.execute("select amount from klienci where klient =" + data) >= amount:
  9.             sql.execute("update klienci set amount =" + amount + " where klient =" + data)
  10.             server.send("Transakcja zaakceptowana")
  11.         else:
  12.             server.send("Transakcja odrzucona")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top