From 66bc040ba834aea2550bf70e0242a9150722bba9 Mon Sep 17 00:00:00 2001 From: Boyan Date: Wed, 20 Jul 2022 17:02:17 +0300 Subject: [PATCH] Started work on a raspi --- .gitignore | 1 + TODO.md | 2 +- main.py | 17 +++++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 55be276..93b2361 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ __pycache__/ *.py[cod] *$py.class +checklist.json # C extensions *.so diff --git a/TODO.md b/TODO.md index 81ba492..cdbcb97 100644 --- a/TODO.md +++ b/TODO.md @@ -1,7 +1,7 @@ * [x] implement ssb * [x] create main.py * [x] eat dinner -* [ ] start working on an actual raspberry pi +* [x] start working on an actual raspberry pi * [ ] get all parts needed * [x] calculate the entire cost, so you can boast that it's probably two-three times cheaper than the cheapest QRP out there * [ ] write the code for the screen/leds/buttons diff --git a/main.py b/main.py index e69de29..a17c675 100644 --- a/main.py +++ b/main.py @@ -0,0 +1,17 @@ +import RPi.GPIO as GPIO + +def button_press(pin:int): + def button_callback(channel): + GPIO.cleanup() + return True + + GPIO.setwarnings(False) + GPIO.setmode(GPIO.BOARD) # physical numbers + + GPIO.setup(pin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) + GPIO.add_event_detect(pin,GPIO.RISING,callback=button_callback) + GPIO.cleanup() + return False + +if __name__ == "__main__": + print(button_press(19)) \ No newline at end of file