# Lesson goal: LED visuals for correct or incorrect math problem

Previous: Make an LED flash | Home | Next: Buzz a wrong answer

In the last lesson, you learned how to turn on LED on and off using digitalwrite, with a bit of set up from pinmode. In this lesson, lets make a math-test program that asks students a math problem. If they get it right, we'll turn on a green LED. If wrong, a red LED.

# Now you try. Go for it! Build us a right/wrong light-up math tester!

This code will not run! First, fix the random statement to reflect the range of numbers that you wish to have in your math test. Then, following the logic, see how the variable sum holds the correct answer, and ans is the answer the person typed? Given that the red LED (for the wrong answer) is on pin 13 and the green LED (for the correct answer) is on pin 12, fix the if statement condition and the two digitalwrite line make this all happen.

Here is what your Arduino assembly should look like for this lesson: Dismiss.
Show a friend, family member, or teacher what you've done!