Go Down

Topic: Java on Arduino (Read 1 time) previous topic - next topic

michael_x

Quote
the focus is on learning Java well enough to pass the AP exam, not to learn to program generally.

If they have to learn Java for an exam, don't show them an Arduino ( or other "small" microcontrollers ).
Java is about being hardware independent.

On the other hand, here you won't be successful if you are not aware that a char is 8 bits (and the meaning of non ASCII chars is undefined), and that all variables and stack live in 2k of RAM without garbage collection. Operating system consists of a Reset, Timers and 2 Interrupts and the Arduino IDE just adds a main() to your code. 
Being aware of the limits and seeing the direct interaction with reality (electricity of 5V and very few mA, at least), that's what such a school project would teach.

The language itself is "roughly the same", the environment where and how the code is running, that's the difference to teach (or confuse).


AWOL

Quote
Java is about being hardware independent.

Remind me again why the Blessed K&R developed C?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Brian Neltner

Yeah, I'm a little confused about this. I don't think about how garbage collection works when I write in C either (I'm not a very good programmer, so I don't really use memory allocation). But I do know that when I write in assembly the code is *not* portable. But when I write in C is generally is.

Maybe you mean that java is designed to be platform independent? Certainly you need a different compiler to write code for linux and windows despite them both operating on the same hardware.

And given that this is the case, what is the difference between running java bytecode in a JVM on an arduino versus a JVM on i386?

Granted, it might run slow as molasses if they try to do nothing but 32-bit floating arithmetic, but speed isn't necessarily all that important for a teaching tool. But perhaps I could use the new arduino setup that runs on ARM instead of AVR (or a maple). But my suspicion is that the JVM for AVR might be totally sufficient for the simple kinds of operations most likely to be desired.

AWOL

Quote
I don't think about how garbage collection works when I write in C either

That's a useful mindset to have, because C doesn't do garbage collection.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Brian Neltner

Well then.

All I know is that I first programmed microcontrollers in assembly, so for me C is an amazing blessing in comparison ;-) I assume Java is minimally different.

Go Up