Mystery Code
Will this ever run on Propeller?
Where does the example come from?
Where does the example come from?
void setup(){ Serial.begin(9600); } void loop() { int i = 2; int j = 3; int k; k = myMultiplyFunction(i, j); // k now contains 6 Serial.println(k); delay(500); } int myMultiplyFunction(int x, int y){ int result; result = x * y; return result; }
Comments
In FemtoBasic, it's functionally equivalent to:
100 let i = 2
110 let j = 3
120 print i * j
130 pause 500
140 goto 120
I don't mean to say that it can't be done. The Arduino development system normally uses only a subset of the features of C++ that could be just as easily be compiled into Prop code as C and we already have two C compilers available with a 3rd on the way. There are some C++ to C compilers available, but it would take a bit of work to put everything together and make sure it works properly.
The GCC compiler porting effort (of which Jazzed is a part of) would most likely allow C++. However, emulating the Arduino's Analog I/O would be the bigger issue (most likely requiring extra hardware beyond just a Propeller). The code snippet posted probably could run--but not all of the Arduino code examples would. Don't get me wrong--I think it is a great idea! I just think, like Mike, that it will be pretty involved work.
Is GCC not just a form of a translater?
Andy
Can't see all the code in the code box on my Android phone here but I'm sure providing the Arduino class interfaces would not be such a major task.
Propeller GCC is already running C++ to a point. Things keep getting better everyday.
Just a matter of someone writing an appropriate library with arduino compatible interface spitting out the prop codes to do the intended functions provided they are within the capabilities of the prop hardware I would think.
No, not major - I believe the source for the Arduino libraries are all open source and freely available, and should be easily ported to the Propeller. However, I sincerely hope that all the time, money and effort Parallax is pouring into GCC has more ambitious goals than to simply turning the Propeller into yet another Arduino "wannabe" - the Propeller has so much more to offer than that!
The Arduino has carved out a niche for itself that it (quite naturally) fits very well. And of course Arduinos are dirt cheap - I doubt any Prop-based board could compete with the low end Arduino boards on price. Worse - for most purposes where you might use an Arduino, the price/performance ratio would rule out both the Prop I (at the lower end), and the Prop II (at the upper end). I don't know the price of the latest ARM-based Arduinos - but I'd be willing to bet they'll be cheaper than any equivalent Prop II-based boards - and they'll be available sooner.
The main problem with trying to compete with the Arduino is that it is perfectly suited for the kind of applications that it gets used for. The Propeller (I & II) both fit uncomfortably in the same space. For some types of applications they are simply not fast enough to compete, and for others their sophisticated capabilities are pure overkill, and also too difficult for people to use effectively - especially once you move beyond the world of simple (but very effective) IDEs and tools.
This was one thing that both the Prop I and the Arduino got so right - their IDE is so simple that most people can just jump right in and get something running even if they have no programming background at all.
Ross.
You make good points about the price/performance issue in the Arduino world. However, I think it would be useful for Prop users to be able to run Arduino code on the Prop. There are also cases where someone familiar with Arduino would like to try out the Prop. This would make it much easier for them to get familiar with the Prop. I suspect there are cases where the Prop provides the specific features that are needed for some applications, and there would be a need to run Arduino code on it.
Dave
The fact that Arduino also happens to use the GCC solution as it's key enabling technology is not lost on the objective reader.
Yes, I kind of figured this would be the response. Good luck with that.
Post Edit: That sounded a bit sharp - just to clarify, I mean "Good luck with enticing hobbyist/Arduino users using this approach", not "Good luck with GCC" (which I believe is going quite well).