-
- Posts: 58
- Joined: Mon Jul 16, 2012 6:39 am
Arduino language...
Hey guys, would it be possible to use the arduino language on the pi to control the GPIO pins??? Would be really really helpful if it would be possible!!! Let me know your thoughts!
Re: Arduino language...
If you mean to use the arduino's IDE, then the answer is no.
But if you mean, can i program it in a arduino like language, than yes.
Example "DexBasic" bare metal:
I have also seen similar code for running from linux.
But if you mean, can i program it in a arduino like language, than yes.
Example "DexBasic" bare metal:
Code: Select all
include 'DexBasic\DexBasic.inc'
pinMode GPIO16, OUTPUT
LetsLoop:
digitalWrite GPIO16, HIGH
delayMicroseconds 1000000
digitalWrite GPIO16, LOW
delayMicroseconds 1000000
goto LetsLoop
align 4
ProgramSize:
ScreenBuffer:
Batteries not included, Some assembly required.
- exartemarte
- Posts: 376
- Joined: Sat Mar 03, 2012 3:51 pm
- Location: Middle England
- Contact: Website
Re: Arduino language...
Yes.Justwondering321 wrote:Hey guys, would it be possible to use the arduino language on the pi to control the GPIO pins??? Would be really really helpful if it would be possible!!! Let me know your thoughts!
As DexOS points out above you can't use the Arduino IDE, but that's no loss. The Arduino programming language, for practical purposes, is C with Arduino extensions for accessing I/O ports. The same C compiler (GCC) is available on the Pi - in Debian it's installed by default - and if you install Gordon's wiringPi that adds Arduino-type functions (digitalWrite(), digitalRead(), etc) for accessing the GPIO ports.
You will need to use makefiles - that's something that is hidden from you in the Arduino IDE - but if you start with Gordon's example programs and his makefiles you can modify the makefiles to suit your own programs. Once you get into it, it's a lot easier than it sounds.
You will also need an editor. I don't use Linux editors, by and large (see below), but there are several available. Geany seems to be quite popular; Nano is available from the command line and has prompts on-screen for the basic functions; Vi is available from the command line but gives you no clues whatsoever - not even how to get out of it.
My own preference, outlined in this post, is to access the Pi remotely using a Windows pc to edit the files, with a terminal window to compile and execute them on the Pi. I dare say that Linux afficionados will shudder in disgust, but it works for me.
Re: Arduino language...
Why not Processing on RasPi?
It should be also the easy way to let arduino/raspi to communicate each other.
It should be also the easy way to let arduino/raspi to communicate each other.