12

How to write a good answer

Some new users on Stack Exchange may find the system of flagging, voting and commenting a bit difficult to follow, or frustrating, even.

This post is intended as a guide to writing a good answer.

A good answer

  • Will help the OP (Original Poster - the person who asked the question)
  • May be accepted by the OP, thus giving a +15 reputation bonus
  • May be up-voted by multiple people, each up-vote giving a +10 reputation bonus
  • May attract positive or helpful comments under the answer
  • Will help other people in the future (people with a similar question)
  • As your reputation increases your privileges on the site will increase

A bad answer

  • May attract down-votes, each down-vote deducting 2 reputation points from the person who made the answer
  • A lot of down-votes may cause the question to be automatically closed
  • May be flagged for moderator attention, possibly leading to its deletion
  • Too many negative flags (agreed to by the moderators) may lead to a temporary suspension of privileges
  • May attract negative comments

This is not a forum

Stack Exchange has a different model to most forums. On a forum (for example The Arduino Forum) answers are likely to build on previous answers, a bit like this:

Q. I've connected my LED to the Arduino output pin and earth, and set that pin to OUTPUT and HIGH. However the LED does not light up. Why is that?

John: You may have it in backwards.

Emma: You also need a current-limiting resistor.

James: Good idea! 220 ohms would be about right.

Olivia: Make sure you have the pin set to OUTPUT.

Ethan: See this web page

Sophia: What colour LED is it?

In a forum this is perfectly reasonable, and the overall answer is an amalgamation of each response. However here most of those answers would be down-voted or flagged as too short, "not an answer", or "link-only".

If you are used to forums, you may be aggrieved that a response that was perfectly acceptable on a forum gets down-votes, negative comments, or is possibly deleted entirely.

Answers should stand alone

Answers on Stack Exchange should stand on their own, and not rely upon snippets of information from other answers, or comments.

What you need to do is take the time to make a comprehensive reply that will not only help the OP today, but stand as a beacon of helpfulness for people in the next ten years! Something like this:


Example answer

LEDs are polarized, and thus have to be fitted the correct way around. If you have a LED tester or multimeter you can usually work it out by measuring the LED. There are some visual clues, however. If the leads haven't been cut the longer one is the positive lead (anode):

Picture of LED

Also, the negative lead (cathode) will have a small notch cut out of the plastic (viewed from below) like this:

LED showing polarization

LEDs need to be protected from too much current. If you connect an LED directly across a battery or Arduino output pins, the high current through the LED will damage both the LED and the Arduino. You need to limit current, typically to around 20 mA. This is often done with a resistor in series, like this:

LED schematic

Note that the part of the LED symbol with the bar is the negative side (cathode). The 220 ohm resistor will limit the current to around 15 mA for a red LED.

You can visit a LED calculator site. Example of the calculations:

LED calculator

The forward voltage varies depending on the colour of the LED, and typical ones (from that site) are:

LED forward voltages

You can do the calculations yourself by considering that with a forward voltage drop of 2V for a red LED, then there must be a 3V drop over the resistor. Using Ohm's Law:

R = V / I
R = 3 / 0.015
R = 200

The closest standard value is 220 so we use 220 ohms here. Re-arranging the formula we can work out the exact current:

I = V / R
I = 3 / 220
I = 0.014

Thus this arrangement will actually draw 14 mA from the output pin which is in spec for an Arduino output pin.

Example code

const byte ledPin = 5;

void setup()
{
  pinMode(ledPin, OUTPUT);
}

void loop()
{
  digitalWrite(ledPin, HIGH);
  delay(1000);
  digitalWrite(ledPin, LOW);
  delay(1000);
}

More information about using LEDs at Mike Cook's site: The care and feeding of LEDs


The example answer above illustrates:

  • Images of parts to make clear which terminal is which
  • A schematic of the connections
  • Example code
  • An explanation of why a certain resistor value was used
  • Some off-site references for more reading

Answers should not only contain links to other sites

Links can, and probably will, go "link dead" over time. Thus an answer of "see www.xyz.com" which may be helpful today will be useless when "xyz.com" becomes defunct. Preferably summarize, paraphrase, or re-state what the linked site says. Then include the link, if necessary, as "further information". Of course, don't claim the other person's work as your own, so you could say something like "As John Smith says at xyz.com, blah blah blah ...".


Comments on answers

Please feel free to comment on someone's answer if you think something is unclear, or wrong. If you see an obvious typo, and you have enough reputation to do so, you can edit the answer to fix up the problem. However do not change the original intent of the answer.


Make another answer

If you see an answer that you believe isn't the greatest, or there is a better way of doing things, then feel free to post a different answer that explains the situation better. Stack Exchange is designed for this to happen, so that the best answer gets the most votes and "floats" to the top of the answer pool.


If you like an answer, vote for it!

If you see a good answer, vote it up. This helps others (like the OP) know that other people agree with the answer. It also helps the person making the answer get more reputation.


Answers are NOT for:

  • Asking another question - start your own question for that.
  • A "me too!" answer - that is, saying you have the same problem as in the question, and asking if anyone solved it.
  • To ask for more information about the question - use a comment for that if you have enough reputation. If not, answer some other questions until you have built up enough reputation to make comments (currently 50 reputation).
  • For the OP to add additional information, like schematics, code, photos, explanations. Edit the question to do that.
  • To comment on another answer - use a comment under the answer to do that.

References


Related

How to ask a good Arduino question

  • This is a relatively poor example, in particular, the proposed answer is highly inappropriate. A "question" such as "My LED doesn't light up." is not only too broad, it is not even a question, and probably not even on topic here. Such a posting either gets closed, or comments are used to request clarification. Jumping right in and responding to that non-question with a full treatise on LEDs is not appropriate. Frankly the comments you use as a negative example are closer to being appropriate initial responses to the non-question - yes, even the color one (given forward voltages). – Chris Stratton Feb 17 '18 at 22:32
  • What's unique about Stack Exchange is that it is not only not a discussion forum, it is not a textbook or tutorial site either. Questions must be specific, and while answers may go beyond the question, they need to be a specific response to an actual question which has been asked, not a general response triggered by someone expressing non-specific interest in an area of technology. – Chris Stratton Feb 17 '18 at 22:39
  • You make some valid points, but I think the problem here is that the question was a bit vague. I can reword the question to be more of the sort of question that deserves a lengthy answer. I see quite a few answers along the lines of "go look that up on the Internet" which frankly I don't think helps anyone. I wasn't using the "what colour is it?" as a negative example, but as an example of the sort of things you expect on a forum. – Nick Gammon Feb 18 '18 at 0:02
  • Take a look at It’s OK to Ask and Answer Your Own Questions. There Jeff Atwood makes it clear that it is OK to use Stack Exchange to provide some sort of tutorial (even if you have to make up your own question so you can answer it). Arguably, if I ask a question and then answer it, it isn't a genuine question because I already know the answer. – Nick Gammon Feb 18 '18 at 0:09

You must log in to answer this question.

Browse other questions tagged .