//toggling of 9 bulb one by one
from machine import Pin
import time
led_pins_group1 = [5, 4, 0]
led_pins_group2 = [2, 14, 12]
led_pins_group3 = [13, 15, 16]
leds_group1 = [Pin(pin, Pin.OUT) for pin in led_pins_group1]
leds_group2 = [Pin(pin, Pin.OUT) for pin in led_pins_group2]
leds_group3 = [Pin(pin, Pin.OUT) for pin in led_pins_group3]
def toggle_leds(led_group):
for led in led_group:
led.value(not led.value())
while True:
toggle_leds(leds_group1)
time.sleep(1)
toggle_leds(leds_group2)
time.sleep(1)
toggle_leds(leds_group3)
time.sleep(1)