Hi again,
Mosaic:
What got my attention was the price. If you shop around you can get whole dev boards for Arduino for the same price as one PIC chip.
Nigel:
The main thing about C is the data types. You have to always be aware of what data type your variable is and how the instructions will handle that data type. That's the main thing really. Everything else is just a function call really.
But the Arduino IDE really gives you more functionality because of an implementation of C++ rather than just C. So you get to use C++, and many of the libraries use this anyway.
The C++ library has advantages like function overloading, encapsulation.
The only down side is that the C++ language for Arduino may not support all of the C++ language. I think the 'new' command is not supported, which would be a bother to people who are coming from Windows programming. I think this may be because of the resources 'new' may use up on the small uC chip (RAM). That's unless they changed this.
But as long as you keep track of the variable types and their byte use i think you will be happy
For a few examples:
byte A=2; //a single 8 bit number
int B=2; //a single 16 bit signed number (15 bits plus 1 sign bit)
long C=2; //a single 32 bit signed number (31 bits plus 1 sign bit)
Obviously we have to be aware of the memory space because if we try:
A=0xF0;
B=0x10;
C=A+B;
we get an overflow condition in the C variable, which may or may not be planned on. Here the result would be C=0 which we might want or not. If we dont want overflow, then we have to go to a larger data type like 'int' or 'long' or an unsigned version of either of those.
For those same lines if they were all declared as 'long', we would get instead:
C=0x100;
rather than zero.
I am not really done testing the Arduino yet though.
Mosaic:
What got my attention was the price. If you shop around you can get whole dev boards for Arduino for the same price as one PIC chip.
Nigel:
The main thing about C is the data types. You have to always be aware of what data type your variable is and how the instructions will handle that data type. That's the main thing really. Everything else is just a function call really.
But the Arduino IDE really gives you more functionality because of an implementation of C++ rather than just C. So you get to use C++, and many of the libraries use this anyway.
The C++ library has advantages like function overloading, encapsulation.
The only down side is that the C++ language for Arduino may not support all of the C++ language. I think the 'new' command is not supported, which would be a bother to people who are coming from Windows programming. I think this may be because of the resources 'new' may use up on the small uC chip (RAM). That's unless they changed this.
But as long as you keep track of the variable types and their byte use i think you will be happy
For a few examples:
byte A=2; //a single 8 bit number
int B=2; //a single 16 bit signed number (15 bits plus 1 sign bit)
long C=2; //a single 32 bit signed number (31 bits plus 1 sign bit)
Obviously we have to be aware of the memory space because if we try:
A=0xF0;
B=0x10;
C=A+B;
we get an overflow condition in the C variable, which may or may not be planned on. Here the result would be C=0 which we might want or not. If we dont want overflow, then we have to go to a larger data type like 'int' or 'long' or an unsigned version of either of those.
For those same lines if they were all declared as 'long', we would get instead:
C=0x100;
rather than zero.
I am not really done testing the Arduino yet though.
Last edited: