Pymkr and loading programs onto SiPy [SOLVED]



  • I'm sure this question has been asked many times before so sorry about the repetition!
    I just wanted to confirm a couple of things about using Pymkr and loading programs onto my SiPy.

    • To load a program onto the board, do I run the main file and then sync the project?
    • Is the file which runs on the board always the main.py file? Are all other files in the project treated as helper classes?
    • Does this mean all wifi, bluetooth, sigfox, lora execution has to be done in the main.py file?
    • Is there a way to make the board sleep and wake at a trigger from the GPIO pins e.g when it gets a digital HIGH?
    • How do I make a program loop forever (I have been testing with a blinking program in a while (true): loop but it stops after a while)? When does the board automatically fall asleep?
    • What frequency does the Bluetooth operate at? (I know SiPy doesn't have Bluetooth operating yet.)


  • Ok I've realised that to sync I need to press the reset button on the board before clicking sync.
    But why is the question...



  • I don't think sync is working. Is there something wrong with sync fro windows 7? similar to this? -> (Re: Pymkr "Syncing failed!")



  • @daniel I have the following program and after I sync it with my SiPy and then close Pymkr. The SiPy doesn't start my program. The lights don't change.
    And if I sync and then run it, it runs for 8 mins and 35 secs and then freezes on pink.
    Program:

    import pycom
    import time

    #Program for having practise using LED and time
    #colour chart = http://www.nthelp.com/colorcodes.htm

    pycom.heartbeat(False)
    while (True):
    pycom.rgbled(0xCC0000) # red
    time.sleep(3)
    pycom.rgbled(0xFF6600) # orange
    time.sleep(3)
    pycom.rgbled(0xFFFF00) # yellow
    time.sleep(3)
    pycom.rgbled(0x99FF00) # lime
    time.sleep(3)
    pycom.rgbled(0x00CC00) # green
    time.sleep(3)
    pycom.rgbled(0x009966) # aqua
    time.sleep(3)
    pycom.rgbled(0x0033CC) # blue
    time.sleep(3)
    pycom.rgbled(0x330099) # indigo
    time.sleep(3)
    pycom.rgbled(0x660099) # violet
    time.sleep(3)
    pycom.rgbled(0xCC0099) # pink
    time.sleep(3)
    pycom.rgbled(0xFF0033) # magenta
    time.sleep(3)


  • administrators

    Hello SK,

    To load a program onto the board, do I run the main file and then sync the project?

    Just sync the project. Running the main file simply runs that file. That button is used just as a quick way to run a file.

    Is the file which runs on the board always the main.py file? Are all other files in the project treated as helper classes?

    Yes. You can change this behaviour in your boot.py by doing:

    import machine
    machine.main('/flash/other_main_file.py')
    

    Does this mean all wifi, bluetooth, sigfox, lora execution has to be done in the main.py file?

    No, you can put them in any file. MicroPython works exactly like Python 3 regarding this. It's just that by default the file that's executed by default it's main.py. Inside main.py you can import any other files which can run WiFi, Bluetooth and LoRa (and pretty much anything else).

    Is there a way to make the board sleep and wake at a trigger from the GPIO pins e.g when it gets a digital HIGH?

    Not at the moment, but this will be available in future firmware updates (this is just not available in the Espressif IDF at the moment).

    How do I make a program loop forever (I have been testing with a blinking program in a while (true): loop but it stops after a while)? When does the board automatically fall asleep?

    That while true should work. When you say it stops after a while, how much time is that?

    What frequency does the Bluetooth operate at? (I know SiPy doesn't have Bluetooth operating yet.)

    2.4 GHz. Bluetooth is working on the SiPy since yesterday. Please get the latest updater tool and upgrade the firmware on your SiPy.

    Cheers,
    Daniel


Log in to reply
 

Looks like your connection to Pycom Forum was lost, please wait while we try to reconnect.