|
Syntactic whitespace is an abomination that should've died when computers capable of compiling something more complex than COBOL went on sale.
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, waging all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius
Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies.
-- Sarah Hoyt
|
|
|
|
|
Umm - it's not "a version of C" - it is C (AVR C - and actually C and C++ mixed together). The compiler is GCC.
The "front" you see (with the setup() and loop() functions) - those functions are called by a simple main() - essentially setup() is called first, then loop() is called over and over in a for(;;) construct (or something similar).
A preprocessor loads in the main library (Arduino.h or WProgram.h - depending on the version being used) - see http://www.arduino.cc/en/Hacking/BuildProcess[^] for more details.
That library is actually a huge monster - with tons of compiler directives and checks for which processor is being compiled for - to get the pin and other assignments correct. It's one reason why (on an objective scale) that Arduino code can be comparatively "slow" - because at the core, a ton of checks and other things are being done for you behind the scenes by the library (not to mention the fact that the compiler flags are set to optimize for size over speed - given that you only have a few kilobytes of program space, and even less of memory - that's a good thing).
Could you make your code faster and smaller? Sure - but only at the expense of the code being able to be compiled for only one platform. If you wanted to move the code to another platform, you would be out of luck, until you modified things and recompiled. The system could have probably been made better (ie - independent main libraries per platform, instead of one single giant library) - but given it's origins (the Wiring and Processing hardware/software platform combo) - it's saddled with some baggage that seems impossible to move away from without breaking something or making it more complex for the Arduino's target audience (ie - artists and students, some of whom have never programmed or understand programming). It's also why the IDE is such a (lovable to some) dog - it's based off the Processing IDE, and shares much with it.
You can go more bare metal - remember, the Arduino is not the board or the microcontroller - but an entire platform and a community. Nothing says you have to forever only use the Arduino system. If you get better at things, you can certainly ditch the bootloader, and code for the ATMega328 (or other) in straight AVR C (and include inline assembler if you want). In fact, the bootloader and the main library are all done in regular AVR C/C++ - check it all out sometime and see how they did things. Just be aware, though, that you might code something that works great on say the ATMega328 - but fails on a 644 (for instance).
I'm sure you can code in C/C++ for the Raspberry Pi - just don't expect it to be a super-simple easy process (ie - compile and go, then refactor and do it all again) - you'll likely need to set up a small build chain and a make file at least for each project.
Python is meant to be a quick turnaround language - you can code and run it, quickly make changes, then run it again to see the results. You can also go in an "interactive" editor mode, and run snippets of code and/or commands and see the results instantly. It makes for a very easy and approachable system for development, at the expense of code speed. Nothing stops you, though, from writing some C for speed critical parts, and linking them to your Python code if you want, though.
|
|
|
|
|
Thank you! I've been stagnating in a job where I make web apps for a federal agency, using .NET. At my very ripe old age I feel like a nube in so many areas. The Arduino and Raspberry Pi are hobbies that take the place of vegetating in front of the TV.
I have started on Jeremy Blum's Electrical Engineering series using Arduino. I am over half way into Learning Python the Hard Way.
It just felt so good to be using curly braces again. BTW I am keeping a copy of your reply for reference and use as a base for further study.
|
|
|
|
|
Earl Owens wrote: Curly braces forever!
Hear! Hear!
|
|
|
|
|
|
So is it still voter fraud if I vote more than once? I'm a bad man!
Hogan
|
|
|
|
|
It's only fraud (by decree) if you don't vote for the governing party!
|
|
|
|
|
The thing I remember most about Kwekwe Zimbabwe is a very large Mosque.
Was Robert Mugabe speaking to Muslims when he said "If you are here supporting Zanu-PF, your sins have been cleansed"?
Once you lose your pride the rest is easy.
In the end, only three things matter: how much you loved, how gently you lived, and how gracefully you let go of things not meant for you. – Buddha
Simply Elegant Designs JimmyRopes Designs
|
|
|
|
|
I've never been to Kwekwe, so I cannot say, but the statement is as valid in one religion, as it would be in any other! BTW: It was Mugabe's Vice President that made the statement, not the illustrious leader himself.
|
|
|
|
|
Cornelius Henning wrote: It was Mugabe's Vice Resident ...
I hope that was deliberate, and not a typo!
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Intentional or a Freudian slip - You figure it out!
Anyway: It is corrected.
|
|
|
|
|
I only passed through Kwekwe as I was hiking and a very generous Muslim man picked me up and gave me a ride to my destination as long as I was patient and accompanied him on his rounds delivering supplies to businesses.
I remember the Mosque in Kwekwe because it was very large and a very beautiful structure. Also it is the only Mosque I had seen in the entire country.
Once you lose your pride the rest is easy.
In the end, only three things matter: how much you loved, how gently you lived, and how gracefully you let go of things not meant for you. – Buddha
Simply Elegant Designs JimmyRopes Designs
|
|
|
|
|
Since Islam prohibits images or statues of humans, the Muslims have developed intricate geometric designs to decorate their mosques. I have often stood in awe of the designs on Islamic pottery that I have seen in London museums.
|
|
|
|
|
Elections and politics got me a smack on the wrists and he warned next time he'd be sending Sean round.
So if you see a rather thin man in a onesie, with matching diamanté earrings and nipple tassels, who's covered in virgin olive oil -
0. It's Sean.
1. Run.
veni bibi saltavi
|
|
|
|
|
Thanks for the heads-up! I will have to be more careful in future.
|
|
|
|
|
Harare - Zimbabwe's vice president has reportedly told rally-goers in the southern town of Kwekwe that they will be cleansed of their sins if they vote for President Robert Mugabe's party.
So promises the Devil since the beginning of creation.
Marc
|
|
|
|
|
Mugabe's not the old, but the rest is right
veni bibi saltavi
|
|
|
|
|
So yesterday I could definitely hear the hiss of escaping water under pressure somewhere in the kitchen.
Some tiles lifted later and that confirmed that yes, the inward supply pipe is punctured and water escaping.
Because this is before our own house stopcock I go out to the street to find the external one...and there is none to be found.
So I phoned the council who said there's only one common one for the street, which they can only switch off in the day.
Today they come out to switch it off, only to find it has rusted solid.
So tomorrow some men with a JCB are going to dig up and replace the mains stopcock.
I'm glad this also happens to non IT projects.
[ Update ]
I went to the builders providers and got a stick on temporary repair - yes indeed...I have deployed a patch fix!
modified 20-May-15 9:47am.
|
|
|
|
|
Didn't they try turning it off and on again first ?
if(this.signature != "")
{
MessageBox.Show("This is my signature: " + Environment.NewLine + signature);
}
else
{
MessageBox.Show("404-Signature not found");
}
|
|
|
|
|
No they couldn't turn it off, therefore they couldn't turn it on again.
If it helps think coffee in keyboard under Ctrl-Alt-Keys.
|
|
|
|
|
Display Name Taken wrote: If it helps think coffee in keyboard under Ctrl-Alt-Keys.
If smashed hard enough on it, it should still work
if(this.signature != "")
{
MessageBox.Show("This is my signature: " + Environment.NewLine + signature);
}
else
{
MessageBox.Show("404-Signature not found");
}
|
|
|
|
|
I like your thinking, don't try that with a supply pipe to the whole street though.
|
|
|
|
|
While they are busy doing that take the chance to install a separate one for your house.
|
|
|
|
|
That is the plan (Especially if its on their dime)
|
|
|
|
|