Going to Arduino from C#, Java, …

So far I have spent several hours programming Arduino. It has been a very pleasant experience, because, as for many other programmers, seeing things changing behaviour after your code is an exciting sensation. Usually you just see something happening on the screen.

Anyway, first times were sometimes hard: Arduino seemed sometimes doing weird things: stopping, ignoring your code, and so on.

Arduino is programmed in C (ok, C++ if you prefer, at least in theory). As a friend of mine says: “C is well-camouflaged assembler”. So, if you are coming from languages like Java, C#, FORTRAN, Python you likely are not used to think about, for example, array length, You create new arrays, delete them, assign them to variables without any trouble. You don’t know that here in C language everything can hide a trap. In short, arrays are not dynamically managed: you must take charge of their dimension. For instance, if you write:

char arr[2];
arr = "abcdefg";

your code compiles smoothly… and at runtime your last letters will go wandering lost in space somewhere… but surely where they are not allowed to 😉

Advertisements

2 responses to “Going to Arduino from C#, Java, …

  1. Pingback: Going to Arduino from C#, Java, … string trouble | Hydroinformatix the Gaul

  2. Pingback: Arduino as a PLC | Hydroinformatix the Gaul

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s