BLE Data Transfer Question



  • HI i have a project need to send data from pycom to IOS.
    I success send data from peripheral(pycom) to central(IOS)

    However the problem is, the data is too big to send
    after i do research i find out every single send can only 20 bits

    so my idea is cut all data to 20 bits and send data as below
    Pycom -------send first 20 bits----------> IOS
    Pycom <------response whatever------- IOS
    Pycom -------send other 20 bits----------> IOS
    Pycom <------response whatever------- IOS
    Pycom -------send other 20 bits----------> IOS

    is anyone can tell me how to send data in BLE for 300 word of string???

    Below is part of my code

    # See https://docs.pycom.io for more information regarding library specifics
    
    bluetooth = Bluetooth()
    bluetooth.set_advertisement(name='LoPy', service_uuid=b'12312390123456')
    
    def conn_cb (bt_o):
        events = bt_o.events()
        if  events & Bluetooth.CLIENT_CONNECTED:
            print("Client connected")
        elif events & Bluetooth.CLIENT_DISCONNECTED:
            print("Client disconnected")
    
    bluetooth.callback(trigger=Bluetooth.CLIENT_CONNECTED | Bluetooth.CLIENT_DISCONNECTED, handler=conn_cb)
    
    bluetooth.advertise(True)
    
    srv1 = bluetooth.service(uuid=b'1223190123456', isprimary=True)
    chr1 = srv1.characteristic(uuid=b'ab3451230123456', value=5)
    while True:
        print("Send Data")
        chr1.value("here is the data need to be send  it should be a very very long string")
        time.sleep(3.050)
    
    
    


  • Cool, I need it the other way around.
    I would like to send login data from my mobile phone to my Wipy/Lopy.
    Can you help me with how to proceed?


Log in to reply
 

Pycom on Twitter