""" An example "program" which can be used with the ProgramChooser library, see also main.py 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 . """ """ # Feature: blink pico's onboard led (GPIO25) randomly """ from machine import Pin from time import sleep import random def run(): # Initialisierung von GPIO25 als Ausgang led_onboard = Pin(25, Pin.OUT) pause_counter = 0 counter = 0 # repeat for some time (as it's randomly you don't really now) # approx ~30s while counter < 30: # turn LED on led_onboard.on() # wait a short time (80ms) sleep(0.08) # turn LED off led_onboard.off() # wait a shorter time (20ms) sleep(0.02) pause_counter += 1 # make a pause (1s) randomly if pause_counter > random.randint(6,20): sleep(1) print(counter) counter += 1 if __name__ == "__main__": run()