Skip to content

Instantly share code, notes, and snippets.

@bmidgley
Last active January 18, 2023 17:23
Show Gist options
  • Save bmidgley/bf7a1c4a96e55029d3c0e51c1dc0757f to your computer and use it in GitHub Desktop.
Save bmidgley/bf7a1c4a96e55029d3c0e51c1dc0757f to your computer and use it in GitHub Desktop.
# 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