• ProgrammingGo

    Hi,

    I am checking the code on BLE see herebhttp://omz-software.com/pythonista/docs/ios/cb.html where the TI SensorTag is used and I saw that there is a did_disconnect_periperal function which is called in a case the SensorTag is disconnecting. My idea was that as soon as one of the TI Sensortags is disconnecting, that inside this function I am trying to reconnect the node again. I tried to re-connect it by calling cb.connect_peripheral(p) inside did_disconnect_peripheral and it connects the node , but it does not look like that it is going through the other functions to re-discover the services and characteristics because I am not receiving any values anymore.

    My question is if there is a way to have a recursive function that as soon as one TI SensorTag is losing connecting it facilitates the reconnection of it ?

    posted in Pythonista read more
  • ProgrammingGo

    I tried like that:

     def did_discover_peripheral(self, p):
            if p.name and 'Polar' in p.name and not self.peripheral:
                self.peripheral = p
                print('Connecting to heart rate monitor...')
                cb.connect_peripheral(p)
                
               CBCentralManager = objc_util.ObjCClass('CBCentralManager')
    
                cb_manager = CBCentralManager.alloc().init()
    
               print(cb_manager.retrieveConnectedPeripherals())
    

    but I not get anything out from it. Only connecting to heart rate monitor

    posted in Pythonista read more
  • ProgrammingGo

    Hi mikael,
    I tried it out but I am getting the error message "no Objective-c class named"CBCentralManager"

    WHat I am doing wrong?

    posted in Pythonista read more
  • ProgrammingGo

    I found in the cb module description a similar function, but is it object-related : cb.cancel_peripheral_connection(peripheral)
    and in the keyboard interrupt I do not have the reference to the peripheral object, see example which I am using from the documentation

    posted in Pythonista read more
  • ProgrammingGo

    Hi mikael,

    I was trying but it did not work out. Should I exchange it with the cb.reset() for the delegate where the following code is??

    try:
         while True: pass
    except KeyboardInterrupt:
    cb.reset()
    

    posted in Pythonista read more
  • ProgrammingGo

    Hi mikael,

    thank you for your response. Where should I integrate this code? should it be in the did_disconnect function of the example, or should I run this code as standalone?

    posted in Pythonista read more
  • ProgrammingGo

    Hi,

    I am using an Arduino 33 Nano Ble which has BLE functionality. So I was looking on the examples given in Pythonista how to use the cb module to connect to a BLE device.
    Everything is clear and I am able to connect over Pythonista that is running on my iPad to the Arduino board. For the beginning, I used the example code here which I adapted slightly: http://omz-software.com/pythonista/docs/ios/cb.html
    I have only one problem, when I am disconnecting from Bluetooth (pressing the x button in Pythonista) the app tells me that the board is disconnected, but the Arduino keeps still the Bluetooth connection alive. I tried it with an BLE app (LightBlue) from the Appstore and I am not having this problem. Do you know how I could solve it?
    I have the feeling that the did_disconnect callback does not work good.
    Can you give me some suggestions?

    posted in Pythonista read more
  • ProgrammingGo

    Hi I have a question based on the Bluetooth communication between Ti Sensortags and Pythonista.
    Since I can send only max 20Bytes per packets with the sensor tag, I gave a look in the firmware of the Boards and there was a way to increase the MTU Size what I apparently did. --> This is the link of Ti where it was described: https://e2e.ti.com/support/wireless-connectivity/bluetooth/f/538/t/885399

    But how they are describing there I need an MTU exchange request. It means not only the Sensortag needs to have this but as well the phone. I tried it but I cannot receive the extended data package. Do you know how to do it on the iPhone with pythonista?

    posted in Pythonista read more
  • ProgrammingGo

    okay, I will give a trial. What for me is unclear is how I can map the sensor values to the graphic. I mean I know that I have a referential coordinate system and based on that my sensor is moving, but it is not clear how to do it.

    posted in Pythonista read more
  • ProgrammingGo

    @cvp Hi cvp thank you soo much. I will give a look on that. Thank you for your time. If I will have questions I will write here. I am thinking that it would be better to use quaternions instead of euler angler to avoid gimbal lock. I think there should be a lib for that, right?

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!