How to update codes and libraries for arduino 1.0
December 26, 2011 Leave a comment
The arduino 1.0 IDE (integrated development environment), or the arduino software 1.0 has been released for a while now. Some of us are moving slowly to adopt it since all codes and contributed libraries (yeah that includes all my open-source libraries, darn) will have to be modified to run on the new environment. Here is a great article on how to make the change:
Besides the above article, here are some more subtle changes you have to make in order to get on board with the new IDE:
- Any time you have a hardware serial write command with zero as argument such as Serial.write(0) or Serial.write(‘\ 0’), you will have to replace them with the following: Serial.write((uint8_t)0). The reason behind this is that in the new Print class, which Serial class inherits from, the write(char*) method is no longer virtual but actually defined. This write(char*) method and the write(uint8_t) method are both non-virtual and become ambiguous when the argument is zero. The zero could mean zero BYTE value or zero pointer to char array, which is allowed (no other constant values are allowed as pointer). To clear it up, you force the zero into BYTE, or the unsigned 8-bit integer type: uint8_t
- Any other libraries that derive from the Print class will have the same issues. You have to do the above regarding to write(0).
- I’ll add more when I find more updates.
If you are using the New Soft Serial, then I recommend the following change: don’t make any changes and stay with arduino 0022. I have been unable to access the website that hosts the New Soft Serial library and I don’t think the library has been modified for arduino 1.0 yet. I’ll have to wait and see if anything further happens to this library, which I really like.
The NewSoftSerial is actually turned into the official SoftSerial, released with arduino 1.0 so all you have to do is to include the SoftSerial library.