This does NOT work on Raspberry Pi 2!
- Obtain a 8GB (or bigger) SD Card
- Download disk image from http://janos.io/builds/fxos-pi-gpio.img.zip and unzip
- Put SD card in your computer
- Find out where your SD card is mounted (BE REALLY SURE ITS THE RIGHT DEVICE, IT WILL BE WIPED COMPLETELY!!!), f.e. /dev/disk5 on OSX
- On Linux, run:
sudo dd bs=4M if=fxos-pi-gpio.img of=/path/to/your/disk
- On OSX, run:
sudo dd bs=4m if=fxos-pi-gpio.img of=/dev/rdisk5
(do rdisk, not disk here!) - When it's done put it in your Pi and start up
- The demo's are wired like this: yellow LED on GPIO2, red LED on GPIO3, button (wire it as pulldown) on GPIO26.
- Grab this repo: https://github.com/jan-os/janos/tree/gpio
- Check out
apps/system/js/my-app.js
for examples - Go on the same network as the device and run
nmap --open -p 5555 192.168.2.*
(if 192.168.2 is your IP range of course) and use the IP in next step - Connect to the device via
adb
:adb connect 192.168.2.100
- Verify that it works by running
adb logcat
, should see a lot of stuff going on - Run
make install-phone
to update - To debug, use WebIDE
Highly experimental, but to open pin 3 for output, set it to HIGH and then release it again:
navigator.gpio.setPinMode(3, 'output')
.then(pin => {
pin.writeDigital(true)
.then(() => console.log('OK!'))
.catch(ex => console.error('NOK!', ex));
});
Only does digital pins at the moment.
Porting Firefox OS to Rpi is all done by Chris Jones. I just wrote the Gecko APIs that make GPIO possible.
This is how I did it on OSX
I put the downloaded and un-zipped
fxos-pi-gpio.img
in a folder calledRPi_Image
. Then:sunbox:RPi_Image sunbox$ cd ./RPi_Image/
Make sure your SD-Card is unconnected and run:
Now connect your SD-Card and run the command again:
You should see one (or more) new mounting points. In my case it's
/dev/disk4s1
and/dev/disk4s7
. Now unmount them (but leave the SD-Card conected!):Now let's flash the JanOS RPi image on the SD-Card. Replace the name of the partition (
/dev/rdisk4
) with your own one. Take the name of your un-mounted partition (in my casedisk4s1
) and add anr
infront and remove the trailings1
:That's it! 😄