bthomeCP = BTHomeCircuitPlayground()
btad = BTHomeAd()
btad.complete_name = "CP BTHome"
btad.flags.general_discovery = True
btad.flags.le_only = True
btad.s = bthomeCP.get()
print('[' + advertising.to_hex(btad.__bytes__()) + ']')

ble = BLERadio()
pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, brightness=0.2, auto_write=False)

while True:
    btad.s = bthomeCP.get()
    #print('[' + advertising.to_hex(btad.__bytes__()) + ']')
    
    ble.start_advertising(btad)
    # Change this to a non-blocking time comparison
    # That way we can check for button presses in the meantime.
    time.sleep(INTERVAL)
    ble.stop_advertising()