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

Raspberry Pi support #18

Closed
whaleygeek opened this issue Feb 7, 2017 · 8 comments
Closed

Raspberry Pi support #18

whaleygeek opened this issue Feb 7, 2017 · 8 comments

Comments

@whaleygeek
Copy link

A very active member of our community in Kent is looking to run workshops using Raspberry Pi 3 and micro:bit. They wish to use a blocks based approach to coding the micro:bit.

I would like to recommend to them that they try this new release of this web based editor, but they have to build their SD cards this Saturday (11th Feb) in order to be ready in time.

Can you let us know which precise version of the Raspberry Pi OS this new version was tested against, and a list of any known issues with it, so that the volunteer team in particular can correctly configure the editor with confidence that it will work in front of a room load of children?

Additionally, if you have any resources such as screen shots or documentation or worksheets or online documentation that you are aware of for this new editor (even in early beta), could you send through some links to help them get started, as they will need to throw together a quick worksheet for this having never used it before.

Sorry for the somewhat bold request - but the team have a huge amount to prepare to get the whole event organised and prepared of which this is just one aspect of the event, so we would like to know that this is just going to work. If you're not confident that this will work, we would rather you say so now, and I'll recommend that they cancel this aspect of the workshops until we are confident that it will work on this platform.

I tried a version of this master branch first week of January, and when I pressed on the blocks button a blank pane appeared and there were no blocks on it. This was on a Raspberry Pi 2 using a version of the Raspberry Pi official OS as installed about July 2016 I think it was the last version of Jessie before they released Pixel, as it did not have the desktop background. The Pi has since died so I can't be sure the precise version. I also tried to press the DOWNLOAD button for the default code in the text editor, a window opened and then closed and there was no .hex file saved anywhere on the Raspberry Pi filing system, so I just couldn't get it to work (I did a search for .hex files in the os filesystem and nothing came back).

However, this is a great opportunity to get feedback on the new editor, if you think it is now ready and stable on the Raspberry Pi 3. It will be using the standard browser installed on the Pi 3 OS, whatever that is, and whichever version of the OS you advise us it has already been tested on. The devices will not be connected to the internet for the duration of the workshop, and the cards will be pre-installed 1 week before the event.

Thanks very much in advance for your help and expert advice.

@carlosperate
Copy link
Contributor

carlosperate commented Feb 7, 2017

Hi David,

For the new editor to work correctly there is three important things to remember, as mentioned in the readme file:

  1. After cloning the repository it needs to have the submodules initialised.
  2. The editor page needs to be served from a server, so you can do python -m SimpleHTTPServer in the repository directory and access the editor from localhost:8000/editor.html. I believe this is also what the show.sh script will do. This step could be bypassed, but some browsers can be a bit picky about running some js from a local file, so this is a good step to follow in order to ensure everything works as expected.
  3. You need a modern browser, so in this case the chromium browser that comes with Pixel will do fine.

I just tried it in a Pi I set up around November and seems to be working fine, including the new Load option.

@whaleygeek
Copy link
Author

Thanks Carlos.

The submodule thing is going to be a pain, the usual way we install this stuff is to download a zip and copy it onto the Pi using a USB memory stick. If every Pi has to be connected to the internet individually to do an install, that's not a great experience to be honest. Is there any way to avoid that step? What is the submodule thing actually for, and why can't a download-zip do the same?

So, can I confirm the setup steps (as your instructions and the instructions in the README.md differ slightly and I need to point the user to a definitive set of instructions they can just follow with confidence that they can delegate this to their card building volunteer and it will 'just work'.

Install a recent pixel OS onto the Raspberry Pi
Connect the Pi to the internet
From LXTerminal...
git clone https://github.com/bbcmicrobit/PythonEditor
git submodule update --init --recursive (should we be in the PythonEditor folder here now?)
cd PythonEditor
./show.sh

Open the chromium web browser that is pre-installed in that OS
browse to the URL: localhost:8000/editor.html

Edit code in text or blocks. When it is ready, press the DOWNLOAD button and a .hex file will be saved (where, in the /home/pi directory? What will it be called, will it have a default name, can you override the name in the editor like PXT allows?)

Open File Manager from the menu, plug in your micro:bit, drag and drop the .hex file that is in /home/pi onto the MICROBIT drive, and wait for the light to stop flashing, then the code will run.

If there is a syntax error in your code, it will scroll across the micro:bit single character display slowly to tell you what line the error is at - fix the error in your code in the web editor and try again.

Please note I am mobile with no access to a Pi, so please excuse my daft questions.

Also, I think there should be a note on the README.md page saying 'don't just click on the editor.html file it won't work properly' - some instructions that @ntoll sent me for the PWM fix testing said to double click on that file and it used to work. If this no longer works or is no longer a recommended way of using the editor, I think the install/usage instructions should say so (otherwise users will see the file and just double click on it).

Thanks!

@carlosperate
Copy link
Contributor

carlosperate commented Feb 7, 2017

Thanks Carlos.

The submodule thing is going to be a pain, the usual way we install this stuff is to download a zip and >copy it onto the Pi using a USB memory stick. If every Pi has to be connected to the internet >individually to do an install, that's not a great experience to be honest. Is there any way to avoid that >step? What is the submodule thing actually for, and why can't a download-zip do the same?

If normally most people end up coping it into the pi from a USB stick then as long as the submodules are initialised in the stick it should be fine.
We could use the GitHub releases mechanism to upload read-to-use zip files, so user's wouldn't need to know how to use git.
@ntoll since we are already versioning and the changes file has been kept well maintained, this should be quite trivial, and could easily be retroactively done for the last couple of versions.

So, can I confirm the setup steps (as your instructions and the instructions in the README.md differ >slightly and I need to point the user to a definitive set of instructions they can just follow with >confidence that they can delegate this to their card building volunteer and it will 'just work'.

Sorry, I should have clarified that I was also listing the steps from memory, I should have quoted the README directly, so please disregard my previous steps if they do differ.

Install a recent pixel OS onto the Raspberry Pi
Connect the Pi to the internet
From LXTerminal...
git clone https://github.com/bbcmicrobit/PythonEditor

Add: cd PythonEditor

git submodule update --init --recursive (should we be in the PythonEditor folder here now?)

Yes, we shoud cd into the PythonEditor folder as shown above.

cd PythonEditor

This step should be removed from this position, as it's been moved up.

./show.sh

Open the chromium web browser that is pre-installed in that OS
browse to the URL: localhost:8000/editor.html

Edit code in text or blocks. When it is ready, press the DOWNLOAD button and a .hex file will be saved >(where, in the /home/pi directory? What will it be called, will it have a default name, can you override >the name in the editor like PXT allows?)

File is microbit.hex, directory is browser and user settings dependent, by default chromium will save it to the user downloads folder, e.g. /home/pi/Downloads/.

Open File Manager from the menu, plug in your micro:bit, drag and drop the .hex file that is in >/home/pi onto the MICROBIT drive, and wait for the light to stop flashing, then the code will run.

If there is a syntax error in your code, it will scroll across the micro:bit single character display slowly to >tell you what line the error is at - fix the error in your code in the web editor and try again.

Please note I am mobile with no access to a Pi, so please excuse my daft questions.

Also, I think there should be a note on the README.md page saying 'don't just click on the editor.html >file it won't work properly' - some instructions that @ntoll sent me for the PWM fix testing said to >double click on that file and it used to work. If this no longer works or is no longer a recommended way >of using the editor, I think the install/usage instructions should say so (otherwise users will see the file >and just double click on it).

That step was me being overly cautions due to different browsers having different security settings. I believe the only difference would be the "share button" not appearing, and that's already dealt with internally by the editor, so it should not fail. I do believe everything should work fine opening the html file directly, but you were asking for a bullet-proof set of instructions, ergo my comment about ensuring it is run from a server (which is what the show.sh file does).

Thanks!

No problem, let me know if anything needs further clarification.

@ntoll
Copy link
Contributor

ntoll commented Feb 7, 2017

@whaleygeek I've just tried the most recent build of the editor (including blocks) with a Raspberry Pi 2, running latest Pixel OS. Note that this is a relatively underpowered version of the Raspberry Pi.

It works! Even if it is a bit slow to load using the browser. If it's the only thing running in a browser with a single tab, then it's definitely usable. NOTE: as you start using it the browser may need to load files that it'll otherwise cache later, so it may start slow, but should become more responsive.

I've tgz'd the files you'll need to copy onto the Pi, and they can be found here: http://ntoll.org/static/files/python_editor.tar.gz

PLEASE TEST on a Pi 3 and let me know how you get on.

I'll close this issue since there's not much more we can do in this regard.

@ntoll ntoll closed this as completed Feb 7, 2017
@carlosperate
Copy link
Contributor

@ntoll any thoughts on using GH releases to add ready-to-use zip files?

@ntoll
Copy link
Contributor

ntoll commented Feb 7, 2017

Yes. We should do that. Didn't think of it in this case. :-)

@whaleygeek
Copy link
Author

Ace, thank you both for sorting this out - the end user will be very pleased. I have sent them this info and also suggested that they update this ticket with any problems or feedback that they have. Thanks fellas, cracking work.

@bfentiman
Copy link

@ntoll Update from using the GZ at the Jam, run on Pi 3s.

Everything seemed to work within it (well everything we had a chance to get the kids to try and break), definitely worked better than mu (we did one workshop with mu and one with the GZ).

The main issue we found was that it would lag and we had it crash at least once on every Pi. One of the PiTop champions said he would consider keeping it on his Pis as it made more libraries available than mu does.

We're yet to try out the block interface with the kids yet, that will be our aim for the next Jam, so will be able to give a proper rundown on that at a later stage.

I did have a couple of teachers ask how we were running the website without the internet, to which I replied that you guys were working on it.

Thanks for making the GZ for me, it really made my life a lot easier especially when it was during a video games festival.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants