Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Flash new firmware with custom main.py don't work #50

Closed
GianCann opened this issue Jun 16, 2020 · 9 comments
Closed

[Bug] Flash new firmware with custom main.py don't work #50

GianCann opened this issue Jun 16, 2020 · 9 comments
Labels
platform: Powered Up Issues related to LEGO Powered Up software: pybricks-code Issues with https://code.pybricks.com application

Comments

@GianCann
Copy link

I tried to load the firmware with a custom main.py, following the steps explained on the documentation (drag the new .zip file on 'flash firmeare' button).
After drag the zip file, the flash firmware button don't work anymore, with no reaction to click.

@GianCann GianCann added the triage Issues that have not been triaged yet label Jun 16, 2020
@GianCann
Copy link
Author

I have used the v3.0.0a2 firmware
https://github.com/pybricks/pybricks-micropython/releases/tag/v3.0.0a2

@dlech dlech added software: pybricks-code Issues with https://code.pybricks.com application platform: Powered Up Issues related to LEGO Powered Up and removed triage Issues that have not been triaged yet labels Jun 16, 2020
@dlech
Copy link
Member

dlech commented Jun 16, 2020

Can you please check the console log and report back the last few errors listed there after it gets stuck?

If you need step-by-step instructions on how to do this: https://support.google.com/docs/thread/1873663?hl=en

@GianCann
Copy link
Author

I found the error thanks to the console log: the zip contained a sub folder and so the firmware-base.bin has not viewed from the code.pybricks.com
Now I'm flashing the firmware with my custom main.py

@GianCann
Copy link
Author

Ok, firmware loaded with my custom main.py but the program don't start when I press the green button.
This is the program (the light is connected before power on):

from pybricks.pupdevices import Light
from pybricks.parameters import Port
from pybricks.tools import wait, StopWatch
from math import cos, pi

# Initialize the light and a StopWatch
light = Light(Port.A)
watch = StopWatch()

# Cosine pattern properties
PERIOD = 2
MAX = 100

# Make the brightness fade in and out
while True:
    # Get the time in seconds
    time = watch.time()/1000
    
    # Evaluate the cosine
    brightness = (0.5-0.5*cos(time*2*pi/PERIOD))*MAX
    
    # Turn on the light, wait, then repeat
    light.on(brightness)
    wait(10)

@dlech
Copy link
Member

dlech commented Jun 16, 2020

Does the program work when running from the web browser?

@GianCann
Copy link
Author

I think there is a firmware mismatch:

Traceback (most recent call last):
  File "main.py", line 1, in <module>
ImportError: no module named 'pybricks.pupdevices'

@GianCann
Copy link
Author

GianCann commented Jun 16, 2020

Does the program work when running from the web browser?

I have two Technic Hub flashed with Pybrick:

  • the first one flashed with the 'built-in' firmware come with code.pybricks.com: on this hub, the program (from the code editor), works fine.
  • the second one flashed with "my" firmware composed by .bin and .json files get from https://github.com/pybricks/pybricks-micropython/releases/tag/v3.0.0a2, and main.py that contain the "Light" program: with this firmware, the code editor return the error ImportError: no module named 'pybricks.pupdevices'

@dlech
Copy link
Member

dlech commented Jun 16, 2020

It looks like we missed tagging v3.0.0a3. I just started a build, so check the GitHub releases again in a few minutes.

@GianCann
Copy link
Author

Yeah! It's work! ;)
Thank you @dlech

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: Powered Up Issues related to LEGO Powered Up software: pybricks-code Issues with https://code.pybricks.com application
Projects
None yet
Development

No branches or pull requests

2 participants