Commit 18a2fb088d5c4eafb875b423092df06b4c645bed

Authored by Raymond Bakke Pedersen
1 parent 3698c695

La til filer for sending og mottakk av data

Showing 2 changed files with 28 additions and 0 deletions   Show diff stats
serialrx 0 → 100644
  1 +import serial
  2 +
  3 +ser = serial.Serial("/dev/ttyS0")
  4 +
  5 +while(1):
  6 + d_in=ser.readline().decode('ascii')
  7 + d_in = d_in.split(',')
  8 +# if d_in.find("exit")>-1:#Chat
  9 +# print ("program terminated")
  10 +# break
  11 +# else:
  12 +# print("Mottok: "+d_in)
  13 +
  14 + if d_in[0]==("$GPGGA"):#GPS
  15 + print(d_in)
  16 +
  17 +ser.close()
... ...
serialtx 0 → 100644
  1 +import serial
  2 +
  3 +ser = serial.Serial("/dev/ttyS0")
  4 +
  5 +while(1):
  6 + d_out=input("Ka han sir? ->")+"\n"
  7 + ser.write(d_out.encode('ascii'))
  8 + if d_out=="exit\n":
  9 + break
  10 +
  11 +ser.close()
... ...