Hacker News new | ask | show | jobs
by escaped_hn 3879 days ago
How to open a file in 10 different programming languages.
3 comments

It is a little more than that as you also need to write alternating state to the file, but you are right, and that is the point of the post. You can read/write embedded sensors/actuators in whatever language you are comfortable by simply reading/writing from the Linux file system.
.. on a correctly set up beaglebone, not other systems. It would be much better if this were in the title.

On most embedded systems and FPGAs faffing with the toolchain and hunting in the documentation is 99% of the effort of getting an LED blinking, that's why it's used as the embedded 'hello world'.

good point, I updated the front matter of the post to make this more explicit.
...if your Linux base port has the chip-specific GPIO driver wired up correctly and is enabled in the kernel along with the sysfs interface.
Yeah this exactly, I was disappointed reading the article.
On Linux you're allowed to mmap gpio as well if I'm not mistaken.
Yep, mmap is definitely a possibility here, though finding out where everything is is a bit of a pain (Derek Molloy's device tree charts really help here: http://derekmolloy.ie/beaglebone/beaglebone-gpio-programming...).

An example of LED toggling via mmap on the Beaglebone is here: https://github.com/MarkAYoder/BeagleBoard-exercises/blob/mas... (and the associated tutorial: http://elinux.org/EBC_Exercise_11b_gpio_via_mmap)