• LoPy4 random number method (solved)

    LoPy lopy4 random examplecode forum
    6
    0 Votes
    6 Posts
    1k Views
    P
    @robert-hh Thanks What I want here is to simulate some users doing 1 of 3 things, so: >>> print(uos.urandom(1)[0] %3) 0 >>> print(uos.urandom(1)[0] %3) 0 >>> print(uos.urandom(1)[0] %3) 1 >>> >>> print(uos.urandom(1)[0] %3) 2 >>> print(uos.urandom(1)[0] %3) 2 simplifies my code and will be OK. Regarding Micropython, I've 'hacked' a bit of other code at times and this is the first time I'm having to find the functions I need, so little things like 'dir(os)' are gems. Dave
  • Syntax Error in RGB LED example.

    Discussion example examplecode
    2
    0 Votes
    2 Posts
    722 Views
    J
    @torsi That's now fixed, thank you for your report
  • 0 Votes
    1 Posts
    930 Views
    No one has replied
  • 2 Votes
    4 Posts
    2k Views
    M
    @gertjanvanhethof odd, I had to change a few things: import for LIS2HH12 was in lower but file is upper "acc = LIS2HH12()" - was getting an error that it didn't want any parameter so I emptied that and it's working now I didn't need to change the pins. This is with WiPy 2.0. Odd, looking thru the documentation, the pins for I2C don't match between the pysense and any of the boards. Anyway, it's working for me on 9 and 10. - EDIT - Wondering if it's taken care of in the library now instead. I just commented out the line and it still works. Edit again - yes, looking in the libraries, it's actually set there which makes more sense anyway. Below is working fine: from machine import I2C from LIS2HH12 import LIS2HH12 import time acc = LIS2HH12() while True: print('----------------------------------') print('X, Y, Z:', acc.read()) print('Roll:', acc.roll()) print('Pitch:', acc.pitch()) print('Yaw:', acc.yaw()) time.sleep(1)
  • 0 Votes
    7 Posts
    2k Views
    lollisoftL
    @daniel said in Nanogateway example code does not work. (Import class NanoGateway): @lollisoft I see that you have resolved your issue. You do need the latest firmware in order to run the LoRaWAN nano-gateway. Yes, done. Now running my next long time test. Seems at least today working well.