diff --git a/GPS_read b/GPS_read index f64b726..8da5322 100644 --- a/GPS_read +++ b/GPS_read @@ -1,11 +1,12 @@ import serial import RPi.GPIO as GPIO import time +import os -out_a = 16 -out_b = 12 -in_a = 20 -in_b = 21 +out_a = 6 +out_b = 13 +in_a = 19 +in_b = 26 GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) @@ -28,9 +29,9 @@ while(1): tid = d_in[1] time = tid[:2] min = tid[2:4] - ar = now[3:] - mane=now[1:3] - dag = now[:1] + ar = now[4:] + mane=now[2:4] + dag = now[:2] timezone = ("CET") print('{}.{}.{}-{}:{} {}'.format(ar,mane,dag,time,min,timezone)) oclock = ('{}.{}.{}-{}:{} {}'.format(ar,mane,dag,time,min,timezone)) @@ -53,17 +54,18 @@ while(1): print('{},{}'.format(lofddg, d_in[6])) lon = ('{}'.format(lofddg)) - GPIO.output(out_b, 1) - if GPIO.input(in_a): - f = open ('/var/www/html/index.html','a') -# tilfil = d_in[3]+'\t'+d_in[5]+'\n' - locInfo = '\n' + '

' + oclock + '\n' + lat + '\t' + lon + '\t' + 'star3' +'\t' + '1' + '\n' + <\p> + GPIO.output(out_b, 0) + GPIO.output(out_a, 0) + if GPIO.input(in_a)==0: + f = open ('/var/www/html/data.txt','a') + locInfo = oclock + '\n' + lat + '\t' + lon + '\t' + 'star3' +'\t' + '\n' f.write(locInfo) f.close() print("Location saved!") + GPIO.output(out_b, 1) + elif GPIO.input(in_b)==0: + os.system("shutdown -h now") GPIO.output(out_a, 1) - else: - GPIO.output(out_a, 0) else: print("ERROR: Data is invalid") -- libgit2 0.21.4