Update rpitx.py add blinks to command

sr-frs-rx-mode
Alan Johnston 2 years ago committed by GitHub
parent 30fabfac7f
commit 830934e393
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -12,6 +12,7 @@ from PIL import Image, ImageDraw, ImageFont, ImageColor
def increment_mode(): def increment_mode():
print("increment mode") print("increment mode")
powerPin = 16
try: try:
file = open("/home/pi/CubeSatSim/.mode") file = open("/home/pi/CubeSatSim/.mode")
mode = file.read(1) mode = file.read(1)
@ -23,14 +24,78 @@ def increment_mode():
print(mode) print(mode)
if (mode == 'a'): if (mode == 'a'):
mode = 'f' mode = 'f'
GPIO.output(powerPin, 0); # blink two times
time.sleep(0.1);
GPIO.output(powerPin, 1);
time.sleep(0.1);
GPIO.output(powerPin, 0);
time.sleep(0.1);
GPIO.output(powerPin, 1);
time.sleep(1.5)
elif (mode == 'f'): elif (mode == 'f'):
mode = 'b' mode = 'b'
GPIO.output(powerPin, 0); # blink three times
time.sleep(0.1);
GPIO.output(powerPin, 1);
time.sleep(0.1);
GPIO.output(powerPin, 0);
time.sleep(0.1);
GPIO.output(powerPin, 1);
time.sleep(0.1)
GPIO.output(powerPin, 0);
time.sleep(0.1)
GPIO.output(powerPin, 1);
time.sleep(1.5)
elif (mode == 'b'): elif (mode == 'b'):
mode = 's' mode = 's'
GPIO.output(powerPin, 0); # blink four times
time.sleep(0.1);
GPIO.output(powerPin, 1);
time.sleep(0.1);
GPIO.output(powerPin, 0);
time.sleep(0.1);
GPIO.output(powerPin, 1);
time.sleep(0.1)
GPIO.output(powerPin, 0);
time.sleep(0.1);
GPIO.output(powerPin, 1);
time.sleep(0.1)
GPIO.output(powerPin, 0);
time.sleep(0.1);
GPIO.output(powerPin, 1);
time.sleep(1.5)
elif (mode == 's'): elif (mode == 's'):
mode = 'm' mode = 'm'
GPIO.output(powerPin, 0); # blink five times
time.sleep(0.1);
GPIO.output(powerPin, 1);
time.sleep(0.1);
GPIO.output(powerPin, 0);
time.sleep(0.1);
GPIO.output(powerPin, 1);
time.sleep(0.1)
GPIO.output(powerPin, 0);
time.sleep(0.1);
GPIO.output(powerPin, 1);
time.sleep(0.1)
GPIO.output(powerPin, 0);
time.sleep(0.1);
GPIO.output(powerPin, 1);
time.sleep(0.1)
GPIO.output(powerPin, 0);
time.sleep(0.1);
GPIO.output(powerPin, 1);
time.sleep(1.5)
else: else:
mode = 'a' mode = 'a'
GPIO.output(powerPin, 0); # blink one time
time.sleep(0.1);
GPIO.output(powerPin, 1);
time.sleep(1.5)
try: try:
file = open("/home/pi/CubeSatSim/.mode", "w") file = open("/home/pi/CubeSatSim/.mode", "w")
# count_string = str(command_count) # count_string = str(command_count)
@ -42,8 +107,8 @@ def increment_mode():
GPIO.output(txLed, 0) GPIO.output(txLed, 0)
print("sudo reboot -h now") print("sudo reboot -h now")
GPIO.setwarnings(False) GPIO.setwarnings(False)
GPIO.setup(16, GPIO.OUT) GPIO.setup(powerPin, GPIO.OUT)
GPIO.output(16, 0); GPIO.output(powerPin, 0);
system("reboot -h now") system("reboot -h now")
# release = True; # release = True;
time.sleep(10); time.sleep(10);

Loading…
Cancel
Save

Powered by TurnKey Linux.