Given the popularity of the Arduino IDE and the wealth of existing Arduino sketches, can I use the Arduino IDE to write or compile sketches that will run on the Raspberry Pi?
-
Why would you want to do this? Sure, many Arduino sketches could be compiled to run on the Pi, but many more would not because of the differences in hardware.– MilliwaysFeb 3, 2016 at 3:25
-
The interesting thing is that, so far, we have found very few sketches that a actually don't work and in most cases, these highlight areas where the PiDuino library that provides an implementation of the Arduino library on the Pi hadn't gotten it right. Obviously any sketches that assume that they are running on ATmel processors or try be super efficient by poking Arduino registers and memory won't work ... but these appear to be the exception rather than the rule. Other than that, the premise can be that if one learns Arduino APIs ... why not use them?– KolbanFeb 3, 2016 at 5:16
1 Answer
Yes you can compile programs on the Arduino IDE on Windows or Linux and the resulting executables can run directly on the Raspberry Pi. In order to achieve this there are a few steps to follow including installing the Arduino IDE, downloading a tool chain and, most importantly, installing the Github project found here:
https://github.com/me-no-dev/RasPiArduino
A tutorial video illustrating the installation steps can be found here:
https://www.youtube.com/watch?v=lZvhtfUlY8Y
A tutorial video illustrating how to publish directly to the Pi from the Arduino IDE can be found here:
https://www.youtube.com/watch?v=sd5NLSKp1QU
See also:
Disclaimer: Please note that I am a contributor to this Github project. If this post is believed to be considered "advertizing" we'll be glad to remove it. It is felt though that since this is an Open Source project and no similar projects can be found and the topic of Arduino compilation for Pi "feels" relevant ... we honestly believe it to be appropriate. However, if deemed not to be, we will remove this Q&A immediately upon request.
-
If you are the developer me-no-dev or a contributor to the above mentioned project that should be clearly disclosed. Feb 3, 2016 at 1:09
-
Thanks Steve .. have added a disclaimer/disclosure ... hopefully this is a useful Q&A in the Pi Community stack exchange but if not, we will be delighted to remove it immediately upon request.– KolbanFeb 3, 2016 at 1:21
-
1The point is not to prevent you from advertising your project here. The disclaimer is needed so that people know your opinion of the project may be biased, that's all. Mar 7, 2017 at 13:37