This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

pc-ble-driver-py: what is sys.argv and how to define it?

I have a custom nRF52840 board that transmits sensor data (using UART) to a PC with an embedded Bluetooth adapter. I have a code on Matlab that works just fine (using blelist command).  

What it does: setup default adapter, discover the devices, connect to those with right UART characteristics and uses characteristics to read data from nordic board.

I am trying to use and adapt the heart_rate_collector.py and nus_collector.py example for the same purpose but can barely understand half of the code.

First, when I run nus_collector.py (from this forum) it ends with "Please specify connectivity IC identifier", so I even can't even run init() part. So, the sys.argv is not created or corrupted. How can I understand what is it and how I can debug it?

I dig this forum for the answer but only can find the discussion of errors that occurred after.    

   

Parents
  • Hi,

    sys.argv is, simply put, the list of command line arguments that was provided when running the python script from the command line.

    So what it means is that if you run it with e.g. "python heart_rate_collector.py" from the command line, then you need to change that to "python heart_rate_collector.py NRF52", where NRF52 is then command line argument 1 to the script. (Argument 0 is the name of the script itself.) You can also, optionally, provide the serial port (for the connectivity device) as command line argument 2.

    Regards,
    Terje

Reply
  • Hi,

    sys.argv is, simply put, the list of command line arguments that was provided when running the python script from the command line.

    So what it means is that if you run it with e.g. "python heart_rate_collector.py" from the command line, then you need to change that to "python heart_rate_collector.py NRF52", where NRF52 is then command line argument 1 to the script. (Argument 0 is the name of the script itself.) You can also, optionally, provide the serial port (for the connectivity device) as command line argument 2.

    Regards,
    Terje

Children
No Data
Related