• 0 Votes
    1 Posts
    30 Views
    No one has replied
  • Python 2 or 3

    WiPy 2&3 python
    2
    0 Votes
    2 Posts
    128 Views
    robert-hhR
    @Limka said in Python 2 or 3: They're basically the same. Learn 3 and when you need to use 2 (i.e. certain packages only support 2) you can easily switch to 2 I guess that should be the answer to your question. And that's also my opinio. If you start, start with Python 3.
  • Python hex conversion

    Discussion python ble
    2
    0 Votes
    2 Posts
    223 Views
    robert-hhR
    @misterlisty s = "".join(["%02X" % b[i] for i in range(len(service) - 1,-1,-1)]) resulting in: DEEDAAFB000000000000000000000001 sm = s[:8] + "-" + s[8:12] + "-" + s[12:16]+"-"+ s[16:20] + "-" + s[20:] resulting in: DEEDAAFB-0000-0000-0000-000000000001 Which is however on letter longer than the string above. So check whether in the second group it is really three 0's. Edit: for the second step, you can also write: sm = "-".join([s[:8], s[8:12], s[12:16], s[16:20], s[20:]])
  • decode regex search

    MicroPython python
    2
    0 Votes
    2 Posts
    191 Views
    robert-hhR
    @misterlisty for instance: indexs.group(0) But if you search for a fixed string, you can as well use index, e.g. try: found = response.index("2,1") except: found = -1 it returns either the position of the string or raises an error.
  • string.indexof() ?

    MicroPython python
    2
    0 Votes
    2 Posts
    218 Views
    S
    @misterlisty Not sure of the context exactly, but I am thinking you want to extract the "2,1" from the data returned from the CREG+ AT command? I came up with this to extract the RSSI from the LTE connection and use it in a text string for example.. # Get the current LTE signal quality squallteM = lteM.send_at_cmd('AT+CSQ').strip().split() rquallteM = int(squallteM[1].split(',')[0]) # Evaluate the returned signal quality Data rssilteM = 113 - ((rquallteM) * 2) ltesqual = ("LTE RSSI: -{} dbM".format(rssilteM)) The .strip() and .split() operators should do what you want.. Hope it helps.
  • Backup code

    Discussion python
    3
    0 Votes
    3 Posts
    162 Views
    J
    @misterlisty do you mean upgraded version of your code or of the firmware? And how are you performing the update in the first place anyway?
  • Passing one object to another

    Discussion python bluetooh
    1
    0 Votes
    1 Posts
    242 Views
    No one has replied
  • weird behaviour with function

    MicroPython python
    2
    0 Votes
    2 Posts
    347 Views
    J
    @misterlisty The second error is from another call somewhere inside your function (line 852 of main.py).
  • Format date into other format?

    Discussion rtc python
    2
    0 Votes
    2 Posts
    361 Views
    robert-hhR
    @misterlisty Have a look at the Python methods for string formatting, either the % operator for strings or str.format().
  • Tarballs

    Discussion tarballs micropython python code porting
    1
    0 Votes
    1 Posts
    286 Views
    No one has replied
  • Coredump Location

    Discussion coredump gpy python
    1
    0 Votes
    1 Posts
    373 Views
    No one has replied
  • 0 Votes
    100 Posts
    26k Views
    robert-hhR
    @robert-hh said in Wipy 2.0 and save data on my pc, not in flash memory: Which BN055 module I was asking about the vendor and make of the BNO055 board.
  • Pysense temperature and humidity

    LoPy python pysense pycom
    2
    0 Votes
    2 Posts
    858 Views
    danD
    Hi @stefan85e, You can find our example project for the Pysense on GitHub here. It has the main.py with the code and the libraries.
  • Advice needed for LoRa

    Support & Troubleshooting lopy lora pytrack python 868mhz
    2
    0 Votes
    2 Posts
    563 Views
    J
    @han I think you're mixing up several different topics: monitoring that LED (or rather the signal that drives that LED, I suppose?) sleep issues LoRa For the monitoring part, it depends on the lengths you are considering. You could probably simply use interrupts to detect when the signal goes up or low, and compute the time difference to find the length of the pulse. What kind of battery are you using? An active LoPy draws about 50 mA even when doing nothing, so even a 5000 mAh battery would only last 4 days without deep sleep. Light sleep would help you save a bit, but you would still be talking about days or weeks, not months, unless you really have a very large battery, or have an external power supply. If you don't use deep sleep you don't need to nvram_save/restore. If you do go to deep sleep, you'll need to wake on pin to wake up when the LED lights up, but you may have issues measuring the first pulse, so I hope it is repeated...
  • Post Size in http server

    LoPy lopy lora http post python
    1
    0 Votes
    1 Posts
    504 Views
    No one has replied
  • Precise pulse duration

    Discussion lopy4 python pulse
    4
    0 Votes
    4 Posts
    712 Views
    B
    Thank you @robert-hh and @jmarcelino! I will give it a go and report back. :-)
  • Security? How safe !?

    LoPy security lopy python
    1
    0 Votes
    1 Posts
    490 Views
    No one has replied
  • IDE?

    LoPy python
    2
    0 Votes
    2 Posts
    664 Views
    J
    @stefan85e Pycom offers the Pymakr plugin for VS Code or Atom which offers the best integration available. Of course you can also use any IDE and script it using something like https://github.com/dhylands/rshell