Just starting out, writing in java? want c++

Hello,

This is my first post on the board so if im missing some big READ HERE FIRST or NEWBIES GO HERE sign (which i looked for for some time) I guess I'll just ask here.

I have never really done much hardware programming, or really programming in general, besides some rudementary C++ programs, some slightly more complicated java and a whole bunch of perl scripts.

I just got the arduino mega for christmas and immediately proceeded to try and put some code on it. I downloaded the arduino software/driver pack, installed the serial to USB driver, and opened the arduino programming interface (which i must add is VERY nice). I followed a guide online that showed me how to get LEDs to switch on and off and made a little light display for my girlfriend and parents to show them that their money would not be wasted ;).

The first thing i noticed is that im programming in java! What id really like to do is be programming in C++ just due to the simple fact that C++ allows you so much more flexibility, is this possible? is it more practical for someone who wants to really get deep into the thick of it?

Also im not really sure how the arduino WORKS. Ive worked with terms like bootloader and EEPROM but i have no idea how they apply to this little (basically) mini computer. Also i have no idea how the binary works to run all of the hardware, id really like to get into the nitty gritty of the thing because i love to understand how it all ticks.

The first thing i noticed is that im programming in java

The Arduino is C/C++, Processing is Java.

I'd ignore the EEPROM for now, unless you really want to keep settings.
Just concentrate on the basics of PWM and didgital I/O.
Have a look at the playground and the tutorials - there's loads of reading and learning materials there.

alright will do! thanks for the help.

What exactly do you mean by java is processing and the arduino is c++?

Also i HAVE been reading up a bit on PWMs, I understand that theyre basically digital potentiometers but beyond that im not exactly sure what they can do.

The compiler used in the arduino environment is C++, the compiler in the Processing environment is Java.

so that basically means im writing C++ in java? whats the sense in that?

No, if you are writing Arduino sketches and using its IDE, then your code gets passed to a C++ compiler, not a Java one.

oh so i should be writing in C++ syntax?

Yes. You can, of course, just use the subset of C++ which is plain C, if you don't need the object-oriented features of the language.

oh so i should be writing in C++ syntax?

Well, apart from "new" and "delete", pretty much, yes.

PWMs, I understand that theyre basically digital potentiometers but beyond that im not exactly sure what they can do.

Hmm, sort-of.
PWM is a constant frequency square-wave signal (400-500Hz), but with a variable mark/space ratio (the ratio of the on time vs. /off time).
You can use them to dim LEDs by varying the average current through the LED, or control the speed of DC motors (but don't connect resistors to a digital pin directly).

i assume that new and delete are listed under the documentation so ill take a closer look at that when i get some time.

As for the PWMs is there certain commands that i can use to manipulate them? something i could look up in the documentation perhaps?

PWMs - see "analogWrite".

will do, thanks again for the help.

Its funny i was actually already using the analogWrite function with delay to create a little LED display so i guess i already have a bit of experience :P.

i assume that new and delete are listed under the documentation so ill take a closer look at that when i get some time.

Also be sure to check this page Arduino - Home for Arduino-specific language issues.

"Processing" is a programming environment for desktops. Users are craftily tricked into using a subset of Java, and their sketches are handed off to a Java compiler "behind the scenes."

"Wiring" and "Arduino" are programming environments for relatively small microcontroller hardware boards. Users are craftily tricked into using a subset of C++, and their sketches are handed off to a C++ compiler "behind the scenes."

I have noticed that the subset of Java used by Processing and the subset of C++ used by Arduino look a lot alike!

The limitations placed on the programmer by the hardware (especially 1 to 4k of RAM) may restrict you to a subset of C++ that is somewhat unfamiliar.