Espruino on the Pi (with WiringPi)

Posted on
Page
of 2
Prev
/ 2
  • Gordon,

    Configuring Espruino to be available over the network is trival (and wildly insecure). I used the following command, as root:

     socat TCP4-LISTEN:8888,fork,reuseaddr EXEC:/root/Espruino/espruino
    

    All that is left to do is configure Espruino Web IDE to connect via a socket and not the serial port. :)

    Regards

  • There are implications that anyone attempting the above should be aware of. Chiefly, the above command will spawn a new instance of Espruino on the raspberry pi each time the Web IDE connects. It is unlikely this is desireable, I will work on a technique that attaches an incoming port to an already running Espruino instance. Reattaching to a previous session is what people likely expect.

  • That's great - thanks! As you say, horribly insecure, but fun if you're just playing around locally.

    I guess you might be able to make it persist using screen? There's probably a better way using ttys too, but I have no idea how that works :)

  • So I have an orange pi zero, cloned the espruino repo, successfully compilled it and it is runing:

    root@orangepizero:/home/hygy/Espruino# ./espruino 
    Interactive mode.
    Size of JsVar is now 28 bytes
    Size of JsVarRef is now 4 bytes
    Added SIGINT hook
    Added SIGHUP hook
    Added SIGTERM hook
    
    Decompressing to 114688 bytes...
    >1+1
    =2
    

    I cloned and compiled wiringOP:

    root@orangepizero:/home/hygy/WiringOP/gp­io# ./gpio readall
     +-----+-----+----------+------+---+-Oran­ge Pi+---+---+------+---------+-----+--+
     | BCM | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | BCM |
     +-----+-----+----------+------+---+----+­+----+---+------+----------+-----+-----+­
     |     |     |     3.3v |      |   |  1 || 2  |   |      | 5v       |     |     |
     |  12 |   8 |    SDA.0 | ALT5 | 0 |  3 || 4  |   |      | 5V       |     |     |
     |  11 |   9 |    SCL.0 | ALT5 | 0 |  5 || 6  |   |      | 0v       |     |     |
     |   6 |   7 |   GPIO.7 | ALT3 | 0 |  7 || 8  | 0 | ALT3 | TxD3     | 15  | 13  |
     |     |     |       0v |      |   |  9 || 10 | 0 | ALT3 | RxD3     | 16  | 14  |
     |   1 |   0 |     RxD2 | ALT5 | 0 | 11 || 12 | 0 | ALT3 | GPIO.1   | 1   | 110 |
     |   0 |   2 |     TxD2 | ALT5 | 0 | 13 || 14 |   |      | 0v       |     |     |
     |   3 |   3 |     CTS2 | ALT3 | 0 | 15 || 16 | 0 | ALT3 | GPIO.4   | 4   | 68  |
     |     |     |     3.3v |      |   | 17 || 18 | 0 | ALT3 | GPIO.5   | 5   | 71  |
     |  64 |  12 |     MOSI | ALT4 | 0 | 19 || 20 |   |      | 0v       |     |     |
     |  65 |  13 |     MISO | ALT4 | 0 | 21 || 22 | 0 | ALT3 | RTS2     | 6   | 2   |
     |  66 |  14 |     SCLK | ALT4 | 0 | 23 || 24 | 0 | ALT4 | CE0      | 10  | 67  |
     |     |     |       0v |      |   | 25 || 26 | 0 | ALT3 | GPIO.11  | 11  | 21  |
     |  19 |  30 |    SDA.1 | ALT4 | 0 | 27 || 28 | 0 | ALT4 | SCL.1    | 31  | 18  |
     |   7 |  21 |  GPIO.21 | ALT3 | 0 | 29 || 30 |   |      | 0v       |     |     |
     |   8 |  22 |  GPIO.22 | ALT3 | 0 | 31 || 32 | 0 | ALT3 | RTS1     | 26  | 200 |
     |   9 |  23 |  GPIO.23 | ALT3 | 0 | 33 || 34 |   |      | 0v       |     |     |
     |  10 |  24 |  GPIO.24 |  OUT | 1 | 35 || 36 | 0 | ALT3 | CTS1     | 27  | 201 |
     |  20 |  25 |  GPIO.25 |  OUT | 1 | 37 || 38 | 0 | ALT5 | TxD1     | 28  | 198 |
     |     |     |       0v |      |   | 39 || 40 | 0 | ALT5 | RxD1     | 29  | 199 |
     +-----+-----+----------+------+---+----+­+----+---+------+----------+-----+-----+­
     | BCM | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | BCM |
     +-----+-----+----------+------+---+-Oran­ge Pi+---+------+----------+-----+-----+
    

    Now how can I access orange pi zero gpio from espruino?

  • If you recompile Espruino once the wiring-dev libs are installed, the warning about missing wiringpi libs should disappear.

    If you then run as sudo it should start as normal, but when you access the GPIO it'll do it directly

  • Has anyone ever investigated running Espruino natively on the Raspberry Pi, i.e without Raspbian underneath?

  • There was a post on it here: http://forum.espruino.com/conversations/­278380/?offset=25#comment13427964

    And I think some others too. It should well be possible, but I'm not sure it's worth it since you'll spend 90% of your time re-writing networking/graphics/sound/usb/etc libraries.

    I believe you can get realtime linux kernels for the Pi though, and if you just ran Espruino with one of them you should get something very similar with very little effort :)

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Espruino on the Pi (with WiringPi)

Posted by Avatar for Gordon @Gordon

Actions