Question for BLE connect

For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
JoJoLyu
 
Posts: 4
Joined: Thu Dec 02, 2021 1:47 pm

Question for BLE connect

Post by JoJoLyu »

I am working on a project as a toothbrushing timer. My goal is using adafruit clue as a slide show(activate by waving my hands) that shows the steps of brushing tooth, also the board will connect to my phone via bluetooth and send time count down that I can see the time count down on "bluefruitConnect". So far I am stuck with my code, when I run the code, it can only connect with my phone but the slideshow is not working, I do not know why, and if you can help I would be appreciated. my code are here,
import time
import board
from adafruit_ble import BLERadio
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
from adafruit_ble.services.nordic import UARTService

from adafruit_bluefruit_connect.packet import Packet
from adafruit_bluefruit_connect.button_packet import ButtonPacket
from adafruit_slideshow import SlideShow, PlayBackDirection
from adafruit_clue import clue

ble = BLERadio()
uart = UARTService()
advertisement = ProvideServicesAdvertisement(uart)

while True:
value = clue.gesture
ble.start_advertising(advertisement)
while not ble.connected:
pass
#connect bluetooth
while ble.connected:
if uart.in_waiting:
packet = Packet.from_stream(uart)
if isinstance(packet, ButtonPacket):
if packet.pressed:
if packet.button == ButtonPacket.BUTTON_1:
print("start brushing!")
if value:
slideshow = SlideShow(clue.display, auto_advance=False)
clue.pixel.fill((0, 0, 255))
if clue.button_a:
slideshow.direction = PlayBackDirection.FORWARD
slideshow.advance()

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Question for BLE connect

Post by mikeysklar »

Is there any output on the REPL console?

Have you tried running the basic slide show simple test example with files loaded to test it out?

https://circuitpython.readthedocs.io/pr ... tion-notes

Code: Select all

from adafruit_slideshow import PlayBackOrder, SlideShow
import board
import pwmio

slideshow = SlideShow(board.DISPLAY, pwmio.PWMOut(board.TFT_BACKLIGHT), folder="/",
                      loop=False, order=PlayBackOrder.ALPHABETICAL)

while slideshow.update():
    pass

Locked
Please be positive and constructive with your questions and comments.

Return to “Wireless: WiFi and Bluetooth”