1

Is there any way to run Arduino sketches on Raspberry Pi (basically on Raspbian)? I have several projects that work on Arduino and I would like to run the exact same stuff on my Raspberry Pi. Is there a way to just put all the pins off the Arduino, put them on the Raspberry, then adjust the pin number settings in the Arduino sketch, and then run the program on Raspberry?

closed as off-topic by Anonymous Penguin Sep 25 '15 at 21:47

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not appear to be about Arduino, within the scope defined in the help center." – Anonymous Penguin
If this question can be reworded to fit the rules in the help center, please edit the question.

1

Given that most likely the Arduino code is accessing AVR specific registers, probably not, unless you have some compatibility library that redefines all the low level stuff.

I also wonder if you have the same set of peripherals available on the PI (ex: PWM generators and ADCs).

I would rather follow the "spirit" of the code you already have and re-implement it natively in you language of choice.

  • "Given that most likely the Arduino code is accessing AVR specific registers" Except when it's accessing ARM registers. Or STM32 registers. Or ESP8266 registers. – Ignacio Vazquez-Abrams Sep 25 '15 at 9:41
  • Even in the Due case, it's a cortex M3/4, so I doubt it would work easily on the PI, with the Linux kernel assuming to have control of the board. Which reminds me a bit of how Linux used to be run on embedded systems, in the idle thread of the embedded RTOS. – Igor Stoppa Sep 25 '15 at 12:41
0

I assume you don't mean compiled code, but source; in which case Processing would be a good place to look - it's interpreted IIRC so won't run hugely faster, and is 'mostly' compatible so YMMV depending what you're doing..
Arduino IDE is based upon that.

-1

That answer is quite simple, no, this is not possible.

Not the answer you're looking for? Browse other questions tagged or ask your own question.