Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think you can program the Arduino in C/C++ (like every other Microcontroller), but I was under the impression that it actually has a Java Runtime and the usual way is to code Arduino programs in Java.


The Arduino is based around Atmel's 8 bit AVR architecture which really doesn't have what it takes to run a JVM. The ATmega328P which the Arduino Uno board uses has 32KB of code space and 2KB of SRAM which isn't really enough for something like Java. The normal way Arduino projects are built is by defining a "setup" function and a "loop" function which, when compiled, are actually just called by a hidden C++ file with a main function that essentially does this:

    int main(void) {
        setup();
        for (;;)
            loop();
    }
The actual file does a bit more and can be found in their git repository here: https://github.com/arduino/Arduino/blob/master/hardware/ardu...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: