I just got my Uno in the mail today. I've got it plugged in as we speak and I'm going through some tutorials that were included with my unit.
I have some very beginner questions I would like answered if possible.
1.) How do I retrieve the program that is currently on my UNO? I realize I can open a new Sketch and upload the Sketch to the Uno, but can I do this in reverse?
2.) What AC Adapter do I use if i want to have my UNO run with out being attached to my laptop? Can I use an AC->usb adapter like the one my cell phone uses?
3.) My version of UNO appears to not have that big black rectangular chip on it. Instead it's some tiny black square and it says "SMD" Edition. What does that mean?
4.) How easy is it for me to melt/break/destroy this thing? I'm worried if I plug some things in incorrectly it will fry it. Is this a valid concern?
5.) Is it possible for me to use a different Editor than the official Arduino one I have downloaded? How would I go about uploading a Sketch with out it?
6.) Should I "Safely" eject my Arduino from my computer? Or is it ok to just yank the cable out (assuming I'm not uploading/downloading information from it)
7.) What specs are my Uno? Memory, CPU, Mhz etc.
8.) Is there a way I can "live monitor" what the Arduino is doing in real time? Create log files?
That's all I can think of right away, I'm sure I'll have more! So far the experience has been incredibly exciting and rewarding. I am finding the Arduino code incredibly similar to Javascript and I'm fairly confident with that so far.
Hi Wh, glad you're ready to start having fun while learning stuff! Let me take a quick shot at this; others will help I'm sure...
---------------------( COPY )---------------------------
1.) How do I retrieve the program that is currently on my UNO? I realize I can open a new Sketch and upload the Sketch to the Uno, but can I do this in reverse?
--Not really. You could possibly capture the downloaded data, but you won't see anything like the original Sketch source code. Arduino uses a compiler and assembler under the covers; it is not an interpreter of your source code
2.) What AC Adapter do I use if i want to have my UNO run with out being attached to my laptop? Can I use an AC->usb adapter like the one my cell phone uses?
-- Many people us an AC adapter that puts out 9 volts, connected to the External Power jack. This provides more current from the internal 5V regulator for external devices. You CAN use an AC-USB adapter and it will run as if plugged into a regular USB port.
3.) My version of UNO appears to not have that big black rectangular chip on it. Instead it's some tiny black square and it says "SMD" Edition. What does that mean?
-- You have a recent "Surface Mount Device" version of Arduino UNO that was created to be able to use a ATMEGA328 chip that in that small package. There was or is a worldwide shortage of the "Dual Inline Package" (DIP) version of the chip. Downside: It's very difficult to just replace the chip itself or upgrade it.
4.) How easy is it for me to melt/break/destroy this thing? I'm worried if I plug some things in incorrectly it will fry it. Is this a valid concern?
-- Yes: It's fairly robust but not Idiotproof. It's not even Foolproof so I have occasional problems Take special care not to directly connect Arduino pins to 5V or ground if possible; that may allow excessive current to flow if a mistake in hardware or software is made.
5.) Is it possible for me to use a different Editor than the official Arduino one I have downloaded? How would I go about uploading a Sketch with out it?
-- You need to use the Arduino IDE (Integrated Development Environment). But the actual text editor is only part of that and you CAN use an external editor. But then you lose the cool and very helpful highlighting of keywords etc.
6.) Should I "Safely" eject my Arduino from my computer? Or is it ok to just yank the cable out (assuming I'm not uploading/downloading information from it)
-- This is not necessary because it is not really a "Storage Device" to USB.
8.) Is there a way I can "live monitor" what the Arduino is doing in real time? Create log files?
-- See many of the examples that came with your install to see how to use the "Serial Monitor" to see what's happening. There is not a built-in hardware debugger however. You can cust and paste the output in the Serial Monitor or capture output in a different monitor program.
Thank you Terry! I'm frustrated that I don't seem to receive email notifications from this specific forum! I'll have to look into that.
So here is some more questions.
1.) Is the Arduino programming language procedural? I see that everything inside the main program loop just repeats until the power is taken away. Does this mean if I create a Loop inside the main Loop, that code below the Loop must wait for the Loop to finish, kind of like PHP interpreted at run time?
2.) Is there some specific trick to recognizing Resistors? I see that they are color coded, but the color strips are soooo small! Do people really get good enough at recognizing the small color patterns or do they use a magnifying glass or something?
Is there some specific trick to recognizing Resistors? I see that they are color coded, but the color strips are soooo small! Do people really get good enough at recognizing the small color patterns or do they use a magnifying glass or something?
Yes. That "something" is a multimeter. You need one. You know you do.
Is there some specific trick to recognizing Resistors? I see that they are color coded, but the color strips are soooo small! Do people really get good enough at recognizing the small color patterns or do they use a magnifying glass or something?
Yes. That "something" is a multimeter. You need one. You know you do.
wh33t:
1.) Is the Arduino programming language procedural? I see that everything inside the main program loop just repeats until the power is taken away. Does this mean if I create a Loop inside the main Loop, that code below the Loop must wait for the Loop to finish, kind of like PHP interpreted at run time?
it works just like C or Java or other similar languages. The main loop is just like a while(true), infinite loop. Code runs downwards yes, the stuff below gets executed after the current stuff is done.
wh33t:
1.) Is the Arduino programming language procedural? I see that everything inside the main program loop just repeats until the power is taken away. Does this mean if I create a Loop inside the main Loop, that code below the Loop must wait for the Loop to finish, kind of like PHP interpreted at run time?
it works just like C or Java or other similar languages. The main loop is just like a while(true), infinite loop. Code runs downwards yes, the stuff below gets executed after the current stuff is done.
That's what I figured. How would you interrupt a loop then? Lets say you had a motor and a sensor that you wanted to stop or start the motor? Would you just not use a Delay but a true / false condition?
I'm just going through some very basic tutorials right now, I am on a tutorial that shows how motor acceleration can be done using a 50ms delay and a for loop through an analog write. Am I correct in thinking that while this loop is executing, the Arduino is incapable of processing information from a sensor that might want to stop it?
Am I correct in thinking that while this loop is executing, the Arduino is incapable of processing information from a sensor that might want to stop it?
Depends on how the sensor delivers the information. Normally, a sensor is polled, and the Arduino can't poll the sensor while it is executing a delay.
(Digital) sensors can also be connected to the external interrupt pins. These can cause an interrupt when the signal goes HIGH, goes LOW, or both. The interrupt will be processed (by your code) right away.
So if an interrupt is triggered, where in the main loop will the Arduino start back up at? Will it just begin the loop from the beginning or can it remember it's former position?
I suggest reading the datasheet for the Atmega 328 for deeper understanding of interrupts.
Here's a few quotes from it to answer your question:
"When the AVR exits from an interrupt, it will always return to the main program and execute one more instruction before any pending interrupt is served."
"The interrupt execution response for all the enabled AVR interrupts is four clock cycles minimum. After four clock cycles the program vector address for the actual interrupt handling routine is executed. During this four clock cycle period, the Program Counter is pushed onto the Stack."
"A return from an interrupt handling routine takes four clock cycles. During these four clock cycles, the Program Counter (two bytes) is popped back from the Stack, the Stack Pointer is incremented by two, and the I-bit in SREG is set."
eatfrog:
I suggest reading the datasheet for the Atmega 328 for deeper understanding of interrupts.
Here's a few quotes from it to answer your question:
"When the AVR exits from an interrupt, it will always return to the main program and execute one more instruction before any pending interrupt is served."
"The interrupt execution response for all the enabled AVR interrupts is four clock cycles minimum. After four clock cycles the program vector address for the actual interrupt handling routine is executed. During this four clock cycle period, the Program Counter is pushed onto the Stack."
"A return from an interrupt handling routine takes four clock cycles. During these four clock cycles, the Program Counter (two bytes) is popped back from the Stack, the Stack Pointer is incremented by two, and the I-bit in SREG is set."
Ok that's way over my head for now! But I'm sure I will understand it as time progresses.
Here is some simpler questions.
1.) When I upload my Sketches to the Arduino, the program tells me the binary size is 1222 bytes. It appears to be this size regardless of how big the program is (so far at least). Is 1222 bytes some kind of default size? Kind of like how windows can't address a file smaller than 1Kb (or something like that)?
2.) A bunch of LED's, transistors, resistors and a bunch of other random goodies came with my Arduino learning kit. In all of the circuit diagrams the circuit diagrams tell me I must have a 330ohm resistor for each of my LED's and they always appear to be wired on the negative side of the LED. Why do I need to have a 330ohm resistor for the LED? Will I always need that for any LED? Or is it specific to the kind that I have? The LED's I have don't appear to have any visible writing or model number on it. Also, should I always be hooking resistors on the negative side of the LED?
And it's giving me strange results. I want the Arduino to read a value from a potentiometer and then convert the number into a integer between 0 and 255. When I twist the potentiometer it does indeed change brightness, but it's not very smooth and eventually when it should be making the LED brighter it eventually just shuts it off, and then it starts getting bright again as you twist it further. I presume this has something to do with the large number of decimal places the formula is creating.
wh33t:
1.) When I upload my Sketches to the Arduino, the program tells me the binary size is 1222 bytes. It appears to be this size regardless of how big the program is (so far at least). Is 1222 bytes some kind of default size? Kind of like how windows can't address a file smaller than 1Kb (or something like that)?
hmm, what do you mean regardless of how big the program is? if you are just adding stuff that is not used, the compiler sees that there is stuff not used in the code, and removes it before it becomes a binary. do not confuse the size of your code in number of lines with the binary size, they are two different things. plus, stuff gets added and removed "behind the scenes". bare minimum gives me 450b large binary, blink is 1018b.
wh33t:
2.) A bunch of LED's, transistors, resistors and a bunch of other random goodies came with my Arduino learning kit. In all of the circuit diagrams the circuit diagrams tell me I must have a 330ohm resistor for each of my LED's and they always appear to be wired on the negative side of the LED. Why do I need to have a 330ohm resistor for the LED? Will I always need that for any LED? Or is it specific to the kind that I have? The LED's I have don't appear to have any visible writing or model number on it. Also, should I always be hooking resistors on the negative side of the LED?
you can put the resistor on either side of the led really. all leds need some kind of resistor, yes. the reason is in the physics, led's don't "resist" the electrical current passing through, but there is a maximum amount they can handle before they burn out. if you don't limit the amount somehow they will just flash and die. with a resistor you basically just set a maximum limit of current that the led will get. do you remember ohms law? current = voltage / resistance.
I actually ran through some more of my lesson plans and noticed that the binary size was indeed changing. I think I just somehow fluked out and did 5 lessons in a row that compiled the same binary size.
Thank you for explaining the LED resistor question as well. I do understand what a resistor does, I do remember Ohms law, but my lesson plan doesn't say anything about "WHY" I'm using 330ohms with the LED's. There is no make or model number on them, so I have no way of looking up what there max current is. So my question was more related to all LED's in general. Do they all have the same max current or are there different ones and where can I look up that kind of information?
wh33t:
Thank you for explaining the LED resistor question as well. I do understand what a resistor does, I do remember Ohms law, but my lesson plan doesn't say anything about "WHY" I'm using 330ohms with the LED's. There is no make or model number on them, so I have no way of looking up what there max current is. So my question was more related to all LED's in general. Do they all have the same max current or are there different ones and where can I look up that kind of information?
330ohm is a suitable number for the 5v output from the arduino. if you want to understand more about how to calculate a suitable resistor for a led you can read about it here: Light Emitting Diodes (LEDs)
they do not have the same maximum current rating, but if you have no markings it's probably just a cheap no-name LED. if you have lots of them, you could experiment and see when they pop. but it's usually somthing like 10-30mA. when you buy more leds from, say digikey, they have info about it.
example:
Current - Test 20mA
Voltage - Forward (Vf) Typ 2V (this is needed to calculate a suitable resistor too)
wh33t:
Thank you for explaining the LED resistor question as well. I do understand what a resistor does, I do remember Ohms law, but my lesson plan doesn't say anything about "WHY" I'm using 330ohms with the LED's. There is no make or model number on them, so I have no way of looking up what there max current is. So my question was more related to all LED's in general. Do they all have the same max current or are there different ones and where can I look up that kind of information?
330ohm is a suitable number for the 5v output from the arduino. if you want to understand more about how to calculate a suitable resistor for a led you can read about it here: Light Emitting Diodes (LEDs)
they do not have the same maximum current rating, but if you have no markings it's probably just a cheap no-name LED. if you have lots of them, you could experiment and see when they pop. but it's usually somthing like 10-30mA. when you buy more leds from, say digikey, they have info about it.