Navigation

    Welcome to the Pycom forum

    Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. Tags
    3. python
    Log in to post

    • A

      Is there a good tool for converting C code to microPython code?
      Discussion • python micorpython code • • Andy Smith  

      1
      0
      Votes
      1
      Posts
      15
      Views

      No one has replied

    • L

      Python 2 or 3
      WiPy 2&3 • python • • Limka  

      2
      0
      Votes
      2
      Posts
      122
      Views

      robert-hh

      @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.
    • M

      Python hex conversion
      Discussion • ble python • • misterlisty  

      2
      0
      Votes
      2
      Posts
      214
      Views

      robert-hh

      @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:]])
    • M

      decode regex search
      MicroPython • python • • misterlisty  

      2
      0
      Votes
      2
      Posts
      184
      Views

      robert-hh

      @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.
    • M

      string.indexof() ?
      MicroPython • python • • misterlisty  

      2
      0
      Votes
      2
      Posts
      211
      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.
    • M

      Backup code
      Discussion • python • • misterlisty  

      3
      0
      Votes
      3
      Posts
      154
      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?
    • M

      Passing one object to another
      Discussion • python bluetooh • • misterlisty  

      1
      0
      Votes
      1
      Posts
      233
      Views

      No one has replied

    • M

      weird behaviour with function
      MicroPython • python • • misterlisty  

      2
      0
      Votes
      2
      Posts
      329
      Views

      J

      @misterlisty The second error is from another call somewhere inside your function (line 852 of main.py).
    • M

      Format date into other format?
      Discussion • python rtc • • misterlisty  

      2
      0
      Votes
      2
      Posts
      330
      Views

      robert-hh

      @misterlisty Have a look at the Python methods for string formatting, either the % operator for strings or str.format().
    • K

      Tarballs
      Discussion • micropython python tarballs code porting • • kjm  

      1
      0
      Votes
      1
      Posts
      282
      Views

      No one has replied

    • P

      Coredump Location
      Discussion • gpy python coredump • • panda  

      1
      0
      Votes
      1
      Posts
      361
      Views

      No one has replied

    • V

      Wipy 2.0 and save data on my pc, not in flash memory
      WiPy 2&3 • pycom i2c python wipy2.0 saving data • • VFlorio94  

      100
      0
      Votes
      100
      Posts
      25554
      Views

      robert-hh

      @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.
    • S

      Pysense temperature and humidity
      LoPy • pysense pycom python • • stefan85e  

      2
      0
      Votes
      2
      Posts
      828
      Views

      dan

      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.
    • H

      Advice needed for LoRa
      Support & Troubleshooting • lopy lora pytrack python 868mhz • • han  

      2
      0
      Votes
      2
      Posts
      550
      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...
    • A

      Post Size in http server
      LoPy • lopy lora python http post • • AHellLycan  

      1
      0
      Votes
      1
      Posts
      502
      Views

      No one has replied

    • B

      Precise pulse duration
      Discussion • lopy4 python pulse • • berni  

      4
      0
      Votes
      4
      Posts
      685
      Views

      B

      Thank you @robert-hh and @jmarcelino! I will give it a go and report back. :-)
    • S

      Security? How safe !?
      LoPy • lopy python security • • stefan85e  

      1
      0
      Votes
      1
      Posts
      485
      Views

      No one has replied

    • S

      IDE?
      LoPy • python • • stefan85e  

      2
      0
      Votes
      2
      Posts
      641
      Views

      jmarcelino

      @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
    • 1
    • 2
    • 3
    • 1 / 3