I'm a complete newcomer to the strange, exciting world of Arduino!
I've spent the last few days going through the examples and the programming reference, so I thought I was ready for my first sketch. But then I realized that i just don't understand a really simple thing...
How does the "Serial.print" command work? In other words, where does it print to? A file? The screen? I'm confused...!
Why should any one laugh at you? We all had a similar question when we began with programming
The C language has a lot of print like functions, and most of the time you can specify where to print to. file, screen, device, memory, etc. Serial.print is just a shortcut for some complex function to tell that you should 'print' something to the serial port.
I should like to add:
Serial.print uses I/O #1 of the Arduino pins; you might have noticed that it is labeled TX (rather tah print...). This line is also (unnoticeably for the beginner) connected to the USB port. So don't do anything with pins 0 and 1 if you use serial communication.
Yeah, heed deSilva's warning... nobody told me that and I used digital 0 and 1 as an output and input for a sensor and spent WEEKS trying to figure out why Serial.print stopped working! Talk about almost making a noob break down in frustration. To make things worse, it was the very first project I ever made on my own after doing a bunch of example projects. Man I thought I was in the wrong hobby.
May be this is a little bit advanced, but needs mentioning from time to time.
TheArduino/AVR has exactly ONE AD-Converter. That it uses 6 pins (or 8 with the SMD versions) is a kind of fake, called multiplexing. You can easily extend the number of analog inputs through a 50 cents chip called 74HC4051 to as many lines as you like if you are not too demanding in your sampling frequency...
Now that's very interesting. Ultimately I will need about 12 analog inputs (mostly thermistors) Pinpoint accuracy is not required and sampling frequency will probably not be an issue - max once per hour. How do I do this using a 74HC4051?
(BTW, I'm an accountant, not an electronics engineer)
You can easily extend the number of analog inputs through a 50 cents chip called 74HC4051 to as many lines as you like if you are not too demanding in your sampling frequency...
Can you use that same chip for a 12-bit ADC like the MCP3208?
I think so... But each of such multiplexers adds noise to the analog signal by their external wiring and internal working. This might already influence the LSB of a 12-bit ADC. It will hardly influence a 10 bit ADC @5V (=5mV)
Now that's very interesting. Ultimately I will need about 12 analog inputs (mostly thermistors) Pinpoint accuracy is not required and sampling frequency will probably not be an issue - max once per hour. How do I do this using a 74HC4051?