42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
"""
|
|
LoRa-Training / led_tester - Test the leds connected to the board (called green and red)
|
|
Copyright (C) 2024 Benjamin Burkhardt
|
|
|
|
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
"""
|
|
|
|
from machine import Pin
|
|
from time import sleep
|
|
import gc
|
|
|
|
def run(run_forever=False):
|
|
green = Pin(26, Pin.OUT)
|
|
red = Pin(27, Pin.OUT)
|
|
|
|
g = True
|
|
r = None
|
|
counter = 0
|
|
|
|
while counter < 4 or run_forever:
|
|
r = g
|
|
g = not g
|
|
|
|
red.value(r)
|
|
green.value(g)
|
|
|
|
counter += 1
|
|
sleep(0.5)
|
|
|
|
if not run_forever: # do cleanup
|
|
red.value(0)
|
|
green.value(0)
|
|
gc.collect()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
run(True)
|