Foxberry Pi Demo: Difference between revisions
Line 69: | Line 69: | ||
== Run Firefox OS within Raspbian == | == Run Firefox OS within Raspbian == | ||
Now that your host machine, RPi, and development circuits are set up, you can run the demo. Ensure that your RPi's HDMI out is plugged into a TV or monitor; Firefox OS draws directly to the GPU's framebuffer, it doesn't use X11. So currently the Firefox OS display can't be remoted. | |||
The following commands start FFOS | |||
ssh pi@$rpiaddress | |||
sudo ./ffos/start.sh | |||
You should see a lot of logging spew written to your console. Finally, Firefox OS will load the demo application. If all goes well, your screen should blink green/black every second, and the LED in your demo circuit should blink on/off approximately in unison with the screen blinking. | |||
Finally, return to your open copy of <code>$dev/ffos/app/html/app.js</code>. Find the string <code>'green'</code> and change it to <code>'pink'</code>. Save the file. | |||
Now we're going to reload the web app. Foxberry Pi has a "reload button" --- the literal, physical button you built for your development circuit! :) Press that button and hold it down for about a second. Your web app should reload and the background start blinking pink/black, instead of green/black. | |||
So yes, Foxberry Pi enables save-reload web development. | |||
Congratulations! You're ready to develop apps for Foxberry Pi. | |||
== Limitations == | == Limitations == |
Revision as of 07:41, 26 August 2014
This page describes how to install Firefox OS alongside a Raspberry Pi running Raspbian, without disturbing the main Raspbian installation. The Firefox-OS-on-Raspberry-Pi project is known by the codename "Foxberry Pi".
WARNING: for the time being, this demo software is just that, literally demoware. It has no long-term support plan or API compatibility guarantees, and may eat your homework. This demo is mostly intended for developers who are prepared to deal with bleeding-edge software.
Prerequisites
You need a Raspberry Pi, of course. Models B and B+ should work equally well. This guide assumes your Raspberry Pi (here after RPi) is running a recent Raspbian OS. Other distributions will probably work, but haven't been tested.
Install WebIOPi on your RPi. Be sure to test that WebIOPi is working correctly before proceeding.
This guide assumes your RPi is connected to the host machine via Ethernet. A connection through a wifi dongle or USB networking (or ...) should work fine, but hasn't been tested.
It's strongly recommended that you install sshfs on your host machine. On Fedora,
sudo yum install fuse-sshfs
Or on Ubuntu,
sudo apt-get install sshfs
This guide assumes your RPi has the default user "pi" configured.
You need to be able to ssh into your RPi. This means that
- Your Raspberry Pi must have ssh access enabled
- You need to know either your RPi's hostname or IP address. The default hostname is "raspberrypi". We'll call this address
$rpiaddress
from here on.
Ensure that the following command, run from your host computer, allows you to log into your RPi
ssh pi@$rpiaddress
(You'll need to enter the password, which by default is "raspberry". But you changed the password, right? Right??)
Set up Firefox OS inside Raspbian
Download the Firefox OS demo files: File:Foxberry-pi-demo-0.0.tar.gz. Copy the package to your RPi and then extract it into your home directory with
cd tar zxvf Foxberry-pi-demo-0.0.tar.gz
This should create a ffos
folder in your home directory.
Set up your host for web development
Go to a folder you'd like to use for development. We'll refer to that folder as $dev
. Run the following commands
cd $dev mkdir ffos sshfs pi@$rpiaddress:/home/pi/ffos ffos
This mounts a special filesystem on your host machine's $dev/ffos
mount point. The filesystem passes reads and writes through to your Raspberry Pi's ~/ffos
folder. This allows you to develop code using your host computer's editor and without needing to explicitly synchronize files. This is usually far more convenient than alternatives.
Open the file $dev/ffos/app/html/app.js
in your code editor. If you can't open that file, something has gone wrong in your sshfs or RPi setup.
Set up development circuit
This section is optional but strongly recommended. The circuit consists of
- Push-button momentary switch connected to
GPIO22
, configured with a 10k Ohm pull-down resistor - LED connected to
GPIO25
, with 200 Ohm load resistor
You can of course use whatever pins and elements you wish. However, the demo code assumes the pin configuration above.
The push-button switch is the most important element, as we'll see below.
An image of the circuit is included for reference
Run Firefox OS within Raspbian
Now that your host machine, RPi, and development circuits are set up, you can run the demo. Ensure that your RPi's HDMI out is plugged into a TV or monitor; Firefox OS draws directly to the GPU's framebuffer, it doesn't use X11. So currently the Firefox OS display can't be remoted.
The following commands start FFOS
ssh pi@$rpiaddress sudo ./ffos/start.sh
You should see a lot of logging spew written to your console. Finally, Firefox OS will load the demo application. If all goes well, your screen should blink green/black every second, and the LED in your demo circuit should blink on/off approximately in unison with the screen blinking.
Finally, return to your open copy of $dev/ffos/app/html/app.js
. Find the string 'green'
and change it to 'pink'
. Save the file.
Now we're going to reload the web app. Foxberry Pi has a "reload button" --- the literal, physical button you built for your development circuit! :) Press that button and hold it down for about a second. Your web app should reload and the background start blinking pink/black, instead of green/black.
So yes, Foxberry Pi enables save-reload web development.
Congratulations! You're ready to develop apps for Foxberry Pi.