Hi,
is there someone here who could 'translate' the Blink example into AVR C?
Load the sketch in the IDE.
Enable "compile.verbose" in the preferences.
Hit "verify"
Open the directory that is showing up in the log :
It has a name like /tmp/build[LotsOfNumbers].tmp
In this directory you find the file Blink.cpp which is the "Blink in C" you are looking for.
Eberhard
just a second!!!!
Dose this mean I can program in the arduino IED and then easily get the C code to use in AVRDude for other AVRs! :o
Cant find compile.verbose in my preferences, or in my preferences.txt
(using Arduino 17 on a Mac)
Dose this mean I can program in the arduino IED and then easily get the C code to use in AVRDude for other AVRs!
The code that is generated is for the specific board, and does not include any libraries.
Cant find compile.verbose in my preferences, or in my preferences.txt
You have to add it.
so I have to actually read the books on C I have
I hate code!
You sort of need to do/like/love coding just a little bit to enjoy this stuff... it sort of comes as part of the package deal.
Cant find compile.verbose in my preferences, or in my preferences.txt
(using Arduino 17 on a Mac)
Just add them to your preferences.txt (while the IDE is not running).
The IDE will recognize them the next time you start up.
so I have to actually read the books on C I have Cry
I hate code!
I'm pleased to hear you bought/leased books about 'C'. There is no chance you learn it with some half-baked Internet-tutorial.
Eberhard
Sure I appreciate it a necessary evil, I just find it very hard to get my head around.....and its hard to enjoy something your not very good at.
Im totally dyslexic and that dose not help when trying to get to grips with a language that doesn't even have the saving grace of phonetics like a spoken language.
It not for lack of trying....on my bookshelf I have books on codding
Programming And Customizing The Avr Microcontroller
Programming Microcontrollers in C 2nd Ed
Programming in C 3rd Ed by Kochan
And 2 copys? of Sams Teach yourself C in 24 hours
But....
1: they are far from an engaging read, and i find it hard to just sit there and read though something soooooo dull.
2: they are on C, and how every you want to dress it up Arduino code is not C, so im stuck in this wired C vs Arduino programming language battle and not enjoying a sing second of it.
Where as, planning, etching, soldering, prototyping and playing with Arduinos and AVRs is Exceptionally fun.....just wish I had the same buzz from programming
Rant over! ;D
and how every you want to dress it up Arduino code is not C
Wow! I must be in the wrong place then. ;D
Did you see
Yes, but my scrolling finger got tired half-way down
and how every you want to dress it up Arduino code is not C
Arduino code is very much C. The only thing the IDE does other than pass sketches directly to a compiler is to patch up some of the more opaque requirements for forward reference function prototypes... And there's a little bit of C++.
Now, the arduino core library functions are not the same as desktop library functions. But then they couldn't be...
Without the risk of getting into semantics, supports all standard C constructs and some C++ features, is not the same as being C surly?
All the literature seems to say based on C/C++
Under the hood, sketches are passed, with very little modification, to avr-gcc or avr-g++, which are standard full-featured C/C++ compilers. In fact, the same core compiler used to build linux and many other pieces of professional and commercial software.
It IS C. They/we don't stress this because it causes people who have looked at C and had problems (like you?) to get worried. Instead they risk "offending" "real programmers" who might think "I don't want to have anything to do with some fake watered down C-like language!" (before they look more carefully.) But that's OK, because the latter set is a smaller percentage of the target audience. All those people (artists, etc) who manage to make an Arduino do something fun without panicking that they have to learn a difficult and obscure programming language (C) first are a net win.
it causes people who have looked at C and had problems (like you?) to get worried.
;D I get worried by any type of code!
But from the pure entry level type of person like me, coming from a art background it just appears programming a arduino is simpler then programming another AVR though AVRDude.
I see lots of post asking "how do i write [insert Arduino sketch] in C"......and the awsnser is NEVER "the code is the same, they are both C"
Can you see how confusing it can be to someone who dose not know what is going on under the hood?
@Nachtwind I don't know if you found what you were looking for but here is a good start Getting started with the AVR and Linux | Paul Grayson’s Home Page.
I was hugely impressed when I first tried this to find that the code is almost exactly the same as the Microchip C compiler I had been using, which I suppose is how C is meant to be.
it just appears programming a arduino is simpler then programming another AVR though AVRDude.
But that's only because all the difficult bit-twiddling to set up timers and ports has been abstracted for you - you're not even aware what goes on in "init" because you don't need to know.
However, the abstraction is all written in C too.
It really is C through-and-through.