Hi friends, I plan to develop a project using a raspberry pi 2 and the 3DR radios system. I have a script and adding a button and two leds to indicate that the data collection is running. I would like suggestions.
Thank you
This is my code bash
#!/bin/bash
path=”/home/pi/gps_rtk/”
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setwarnings(False)
btn=17
LED1=16
LED2=15
GPIO.setup(btn, GPIO.IN,pull_up_down=GPIO.PUD_UP)
GPIO.setup(LED1,GPIO.OUT)
GPIO.setup(LED2,GPIO.OUT)
BS=False
while(1)
do
if GPIO.input(btn)==0
then
print "=== START ==="
if BS==False
then
#Files names
_time=$(date “+%H%M%S-%d_%m_%y”)
fname_R=$path”rover_”$_time”.ubx”
fname_B=$path”base_”$_time”.ubx”
#ROVER --- 5Hz --- Radio Link
str2str -in serial://ttyUSB0:230400:8:n:1:#ubx -out /home/pi/gps_rtk/ -out $fname_R -c home/pi/gps/m8n_rover_5hz.cmd &
#BASE --- 1Hz --- Radio Link
str2str -in serial://ttyUSB1:115200:8:n:1:#ubx -out /home/pi/gps_rtk/ -out $fname_B -c home/pi/gps/m8n_base_1hz.cmd &
GPIO.output(LED1,True)
GPIO.output(LED2,False)
BS=True
sleep(1)
else
GPIO.output(LED2,True)
GPIO.output(LED1,False)
BS=False
str2str Ctrl-C
print "=== STOP ==="
sleep(1)
fi
fi
done