Last active
January 18, 2023 17:23
-
-
Save bmidgley/bf7a1c4a96e55029d3c0e51c1dc0757f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file is executed on every boot (including wake-boot from deepsleep) | |
#import esp | |
#esp.osdebug(None) | |
import uos, machine | |
#uos.dupterm(None, 1) # disable REPL on UART(0) | |
import gc | |
#import webrepl | |
#webrepl.start() | |
gc.collect() | |
from machine import Pin, ADC | |
from time import sleep | |
led = Pin(2, Pin.OUT) | |
ptt = ADC(0) | |
led(1) | |
transmitting = False | |
while True: | |
ptt_value = ptt.read() | |
if ptt_value < 30: | |
if transmitting == False: | |
transmitting = True | |
led(0) | |
print("started transmission") | |
else: | |
if transmitting == True: | |
transmitting = False | |
led(1) | |
print("ended transmission") | |
sleep(0.2) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment