I'm wondering about accessing the GPIO of the Edison in high-level languages such as Python or Node.
So far I've found MRAA but wondered if there are other options?
I'm wondering about accessing the GPIO of the Edison in high-level languages such as Python or Node.
So far I've found MRAA but wondered if there are other options?
MRAA should be the way to go. Looks like they have Python interface.
Check out this link:
Getting Started With Intel Edison - Python Programming - All
I cannot wait to play with Python and Node on the Edison. Plans are to make that an early write up.
I was wondering if Firmata would work or how does the Arduino and Atom systems communicate?
This article suggests you'd need to be root to run things that access MRAA
There's an article here that is worth reading (the second part) if you want to detect pin changes.
https://www.linux.com/learn/intro-to-Linux/2017/3/intel-edison-linux-maker-machine-matchbox
Mark
So a little more playing
It seems that under /usr/bin there is mraa-gpio which is happy to run from the command line.
The options are.
root@edison:/usr/bin# mraa-gpio Invalid command, options are: list List pins set pin level Set pin to level (0/1) setraw pin level Set pin to level (0/1) via mmap (if available) get pin Get pin level getraw pin Get pin level via mmap (if available) monitor pin Monitor pin level changes version Get mraa version and board name root@edison:/usr/bin#
mraa-gpio version gives you
Version v1.0.0 on Intel Edison
while list
root@edison:/usr/bin# mraa-gpio list
00 J17-1: GPIO PWM 01 J17-2: 02 J17-3: 03 J17-4: 04 J17-5: GPIO 05 J17-6: 06 J17-7: GPIO I2C 07 J17-8: GPIO I2C 08 J17-9: GPIO I2C 09 J17-10: GPIO SPI 10 J17-11: GPIO SPI 11 J17-12: GPIO SPI 12 J17-13: 13 J17-14: GPIO 14 J18-1: GPIO PWM 15 J18-2: GPIO 16 J18-3: 17 J18-4: 18 J18-5: 19 J18-6: GPIO I2C 20 J18-7: GPIO PWM 21 J18-8: GPIO PWM 22 J18-9: 23 J18-10: GPIO SPI 24 J18-11: GPIO SPI 25 J18-12: GPIO 26 J18-13: GPIO UART 27 J18-14: 28 J19-1: 29 J19-2: 30 J19-3: 31 J19-4: GPIO 32 J19-5: GPIO 33 J19-6: GPIO 34 J19-7: 35 J19-8: GPIO UART 36 J19-9: GPIO 37 J19-10: GPIO 38 J19-11: GPIO 39 J19-12: GPIO 40 J19-13: GPIO 41 J19-14: GPIO 42 J20-1: 43 J20-2: 44 J20-3: 45 J20-4: GPIO 46 J20-5: GPIO 47 J20-6: GPIO 48 J20-7: GPIO 49 J20-8: GPIO 50 J20-9: GPIO 51 J20-10: GPIO 52 J20-11: GPIO 53 J20-12: GPIO 54 J20-13: GPIO 55 J20-14: GPIO
I tried setting GPIO 48 (pin 7 on the Arduino shield) and it wouldn't work.
If I used the echo command it worked, and using mraa-gpio get 48, it gave the current state (0 or 1) in response to the echo commands.
So I'm a little puzzled ... more digging is required.
mark
So a little more playing
It seems that under /usr/bin there is mraa-gpio which is happy to run from the command line.
The options are.
root@edison:/usr/bin# mraa-gpio Invalid command, options are: list List pins set pin level Set pin to level (0/1) setraw pin level Set pin to level (0/1) via mmap (if available) get pin Get pin level getraw pin Get pin level via mmap (if available) monitor pin Monitor pin level changes version Get mraa version and board name root@edison:/usr/bin#
mraa-gpio version gives you
Version v1.0.0 on Intel Edison
while list
root@edison:/usr/bin# mraa-gpio list
00 J17-1: GPIO PWM 01 J17-2: 02 J17-3: 03 J17-4: 04 J17-5: GPIO 05 J17-6: 06 J17-7: GPIO I2C 07 J17-8: GPIO I2C 08 J17-9: GPIO I2C 09 J17-10: GPIO SPI 10 J17-11: GPIO SPI 11 J17-12: GPIO SPI 12 J17-13: 13 J17-14: GPIO 14 J18-1: GPIO PWM 15 J18-2: GPIO 16 J18-3: 17 J18-4: 18 J18-5: 19 J18-6: GPIO I2C 20 J18-7: GPIO PWM 21 J18-8: GPIO PWM 22 J18-9: 23 J18-10: GPIO SPI 24 J18-11: GPIO SPI 25 J18-12: GPIO 26 J18-13: GPIO UART 27 J18-14: 28 J19-1: 29 J19-2: 30 J19-3: 31 J19-4: GPIO 32 J19-5: GPIO 33 J19-6: GPIO 34 J19-7: 35 J19-8: GPIO UART 36 J19-9: GPIO 37 J19-10: GPIO 38 J19-11: GPIO 39 J19-12: GPIO 40 J19-13: GPIO 41 J19-14: GPIO 42 J20-1: 43 J20-2: 44 J20-3: 45 J20-4: GPIO 46 J20-5: GPIO 47 J20-6: GPIO 48 J20-7: GPIO 49 J20-8: GPIO 50 J20-9: GPIO 51 J20-10: GPIO 52 J20-11: GPIO 53 J20-12: GPIO 54 J20-13: GPIO 55 J20-14: GPIO
I tried setting GPIO 48 (pin 7 on the Arduino shield) and it wouldn't work.
If I used the echo command it worked, and using mraa-gpio get 48, it gave the current state (0 or 1) in response to the echo commands.
So I'm a little puzzled ... more digging is required.
mark
A little digging and this table shows that the mraa number and the GPIO number (and then the Arduino) are not the same.
It seems mraa 33 is GPIO 48 and it works BUT.
You can use either the echo or the mraa-gpio to set the pin or change it,
BUT if you read the pin with get or getraw, you get a write error.
root@edison:/sys/class/gpio/gpio48# /usr/bin/mraa-gpio getraw 33 Pin 33 = 0 root@edison:/sys/class/gpio/gpio48# echo 1 > value -sh: echo: write error: Operation not permitted root@edison:/sys/class/gpio/gpio48# /usr/bin/mraa-gpio set 33 1 root@edison:/sys/class/gpio/gpio48# echo 0 > value root@edison:/sys/class/gpio/gpio48# /usr/bin/mraa-gpio getraw 33 Pin 33 = 0 root@edison:/sys/class/gpio/gpio48# echo 0 > value -sh: echo: write error: Operation not permitted root@edison:/sys/class/gpio/gpio48#
Seems strange that a read (get) will lock out changing it but you can set it with one method and change it with the other ???
mark