code.py
 1  # SPDX-FileCopyrightText: 2021 Brent Rubell for Adafruit Industries
 2  #
 3  # SPDX-License-Identifier: MIT
 4  
 5  """
 6  'relay.py'.
 7  
 8  =================================================
 9  drives a small relay
10  """
11  
12  import time
13  import board
14  import digitalio
15  
16  RELAY = digitalio.DigitalInOut(board.D2)
17  RELAY.switch_to_output()
18  
19  while True:
20      RELAY.value = not RELAY.value
21      time.sleep(1)