As I posted some weeks ago, if you need to work with strings (or, better, character arrays) in Arduino’s C++, coming from a friendlier development environment, things reveal to be quite hard.
There are anyway two approaches that can relief the pain:
1) An F() procedure exists, moving every declared string from the highly expensive SRAM (in Arduino UNO 2kB) to flash memory (32 kB). I used this method and solved my intermitting (and making me crazy…) problems
2) Using PString library, added by NewSoftSerial and put in official version of Arduino. It is very handy: it hands you a nice object managing a char array and allowing you to modify and search your string
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:
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 😉
I am now trying to use Arduino Ethernet, in order to communicate in LAN with Arduino. Arduino Ethernet allows you to handle just only one board, saving space and money (you could have everything running in – almost – the same way by adding an Ethernet shield to a standard Arduino UNO).
USB serial adapter
It seems a straightforward operation, but a problem arises: the board lacks a USB port. A little (reusable) adapter USB-serial is the simplest solution.
Yes, but in my Windows 7 x64 environment the way turns out to be very steep. I searched the net thoroughly. At the end I found, buried in a technical document of FTDI Ltd. about drivers installation, at chapter 5.4, the indication that their driver will not install on Windows 7 x64. In general
Windows 7 x64 OS will only allow certified drivers to be installed. The certified driver supplied by FTDI will work with VID 0403 and PID 6001 for FT232 and FT245 devices. It will also work with VID 0403 and PID 6010 for FT2232 devices and VID 0403 and PID 6011 for FT4232.
If you have a product where the manufacture has customised the driver but has not re-certified it, then the driver will not load. You should contact your vendor to determine if they will support Windows 7 x64.
So, I’ll now retry with Ubuntu. Can anyone suggest other solutions to this problem?
God made the cat in order that man might have the pleasure of caressing the lion. ~Fernand Mery
If you know how a PLC works, if you are coming from the world of PLCs, probably you’ll find it an obvious assertion: Arduino can be seen and used ALSO as a cheap PLC substitute.
But I am almost sure there is a lot of people, in the kingdom of PCs, thinking PLCs are strange obscure devices, very hard to deal with. For those, I just say that if you look at a PLC, you see a box with usually 2 boxes (same size, by the way) beside: inputs and outputs. PLCs read inputs, process them and send commands to outputs. Do that recall something to you?
As you can imagine, PLC are industrial quality standard devices, even though somewhere you can find some Arduino versions quite… hard.
This simple fact is so true, that it’s even possible to program Arduino with ladder! For non-PLC readers, Ladder is one of the most “ancient” programming language for PLCs, dating to old times of wires and relays. I am not suggesting to you to use Ladder as the new programming language for Arduino, but I found that quite interesting.
Anyway, for those who like having some little hint about the usual way of coding Arduino, I have added this and this posts.
“The world is in your hands, now use it.” – Phil Collins
When I came across Arduino, it seemed to me that a wall collapsed. I mean, the one between my computer and “reality”.
The normal world of the normal person working with normal computers is enormous: through LANs and Internet you can go everywhere, at home, out there in the city, and even to solar systems and to galaxies. But sometimes, just in the corner of your garden, you see through a hole that something else exists. You suddenly remember that you are a real person with a body, in a room and, yes, in a world that you can reach just through a keyboard and a screen, or at the most with a microphone and a speaker. You feel like you lack arms and legs.
These were my feelings, when Arduino came beside me, and told me that we were able to touch things, to hear things and to send them messages. Beautiful! Until then, I thought that those sort of things were accessible only in professional contexts, like PLCs, RTUs and so on (all nice and very important things, anyway, but a little less… approachable).
Now I have used Arduino for a various list of applications, in the kitchen, at home and outdoors. I hope I can present something interesting, even though presenting something original is difficult: there are a lot of already developed projects, ready to be imitated or even just built. Anyway, if you have not yet tried to add hands and foots to your PC, think about that possibility for an instant!
Posted in Arduino, opensource