Hello once again,
While i'm rummaging with Arduino i come up with a bunch of general questions.
A)How does Arduino/IDE handles libraries in low level. I mean, i include i.e. library a,b,c, does the ide downloads all the library and translates it in binary, while saving it in the memory of arduino? So we are wasting a bunch of memory if we include unused libraries.
B)I don't know how to measure the current that Arduino draws. With 3 leds on digital pins 11,10,9, and an LCD my multimeter says 80mamp, should this be correct? I measure it with one probe (com place in multimeter) in ground, and the other (mAmp place in multimeter) in random places on board, i.e in the usb +5 pin (80mamp), parallel to a led (20mamp-the led turns off), in ground and +5 in breadboard (80mamp).Also the multimeter goes from 120mamp,down to 80amp and stays there.Am i doing something wrong, or is it the expected outcome?Please I'm not familiar with electronics and i would like something like schematics to understand any answer.
D)For a more complex program, that has a lot of variables and it used all the "rom" can we write libraries/functions in an a SD card and call them in void loop()?
F)A bit more hardware question.In Arduino uno rev3 smd, how to connect the reset pin to a push button with 4 legs? (the legs are connected per pair).Can the reset pin hangs Arduino?
Thank you very much, English is not my mother tongue so cope with me.
Yes, that is how it works. However, the compiler/linker will figure out what libraries, even what functions within libraries, are used or not used, and not upload those parts that are not used.
most of the time the compiler is clever enough to leave away code parts which will not be used.
Nevertheless there might be things in a library which can cause troubles even if you think you don't use anything. Precompiler #defines might be such an example.
let's assume that "variables" are stored in RAM. You can store data in other places, EEPROM for example, yes even on a SD Card - but please keep in mind that SD will need a lot of SRAM and Flash Memory on top.
In the end you have finite resources available on the Arduino ... you just have to scope with this limits.
Variables are held in ram and do not take space in rom. However, if a variable has a complex initial value, for example a bitmapped image, this could take space in rom. Alternatively that data could be stored on SD card.
Be aware that the library required to use SD card will consume a large amount of memory, in rom and especially in ram, so using an SD card may make things more difficult instead of solving the problem.
If you describe your project in more detail, the forum may be able to help you to decide how to overcome such problems.
Connect the reset pin to one button leg. Connect ground to the diagonally opposite button leg. The Arduino will hang while the button is held down, but will start up when the button is released.
It's not clear from your description exactly how you are connecting your ammeter: a diagram would probably help. But to measure current you need to break the circuit and insert the ammeter in the break. That's difficult to do if say you're powering the Arduino from the usb.
gotcha, i read that eeprom is lifo memory byte-byte, but in arduino is it volatile or non volatile? IE, can we store 1kb of data while the arduino works, after power cycle, can we read them via serial?
Please take a closer look at post #6. Measuring the current is NOT as easy as measuring the voltage. You cannot measure the current by connecting the DMM in parallel to the circuit.
You must break the line where you want to measure the current and then bridge the open circuit via the DMM.
Don't connect the DMM to the circuit like voltage measurement if it is set to measure current. You may damage parts of your circuit.
Try and remember that in current mode a meter acts like a short circuit. So that is why it has to be connecting a break in the circuit, where a short circuit would not matter, it is just connecting up the break.
That is why your LED turned off when you tried to measure the current by putting the meter across the LED. You were in effect shorting it out, and only measuring the current through the resistor, not through the LED.
ok, should i cut any circuit before the load (+ side) or after? (gnd) or it doesn't matter. My questions are pretty basic and "noob" but im coming from a programming background with high level languages and my knowledge in electronics are not only rusted but pretty basic.
this reads for me you are mixing some things.
On an UNO you have 1kb of EEPROM available.
The EEPROM storage is organized bytewise.
One (of 1024) addresses --> can store one Byte.
But you can easily store variables which are larger then one byte.
Read about EEPROM.put and EEPROM.get.
If you define a structure for your data - access to the variables at the different addresses becomes very easy.
EEPROM is non volatile. Stored data will survive a power cycle.
It does not matter as you are measuring the flow of current through your meter. However as a general rule you should not be making any changes to a system that is powered up. This is why current measurement is more tricky than voltage measurement.
You have to power down your system, make the break, insert your meter and then power up again to take your measurement.
With voltage measurements you normally just probe between the ground and the point you want to measure, and you can do this while your circuit is running.
The exception will normally be when you want to measure the voltage across a component. So to measure the current through your LED you could measure the voltage across the resistor and use that voltage along with the resistor value to work out the current by using ohms law.
Measured voltage / resistor value = current
Note you can't do this by measuring the voltage across an LED because you don't know the resistance of an LED. Another way to measure current is to have a low value resistor say one ohm in place of your break and measure the voltage across the resistor and again use ohms law to work out the current. This is because a meter in voltage mode has a very very high resistance as opposed to the vert very low resistance of a current meter.
No I think you misunderstood what you were reading.
A LIFO memory is a Last In First Out memory. It is a structure of memory often called a push down stack.it's main use is to store the return address of a function, that is why functions can be as deep as the stack memory available. This is hidden from you by the C code being a high level language.
To read back what is written to EEPROM, you could upload a different sketch. That sketch could read the data and write it to serial. Then you could upload your recording sketch.
But it would probably be more convenient to make the two sketches into one. You could attach a switch/button to an Arduino pin. At startup/reset, your sketch could check the switch, and if it is closed, read the EEPROM and write to serial. If the switch is open, it can begin recording to the EEPROM.
An important point to know is that EEPROM does not last forever. Each time it is written to, it's life is shortened. I think EEPROM on Uno is supposed to last for 100,000 writes minimum, perhaps more. If your sketch writes to the EEPROM 100 times each day, it could last for 30 years. But, if your sketch updates the EEPROM 100 times per second, it might last only 15 minutes.
Each time you change the selected board, the IDE will re-compile the libraries you include. This allows the libraries to have conditional compilation for different boards. Only the parts of the library you actually use are included in the binary.
No. Only data. For more complex programs, use a model with more memory.