Tuesday, March 5, 2013

LCD Shield: Calculator

     Today I have for you another project I did with my HobbyKing LCD Shield and my Arduino Mega 2560. I made a calculator! One day I decided that my Texas Instruments calculator was simply not enough. Necessity is the mother of invention so..

     Anyway. I did all I was going to do on my toolbox alarm, so I decided I would start on something new. I thought a calculator would be fun. That's what I did.


What it does now:

  • The user selects add, subtract, multiply, or divide
  • The user inputs the first value
  • The user inputs the second value
  • Answer is calculated and printed to screen

Work for the future:

  • Select number by digit (ie. 1000 = 1-0-0-0. Current model would involve 1000 button pushes)
  • Add push and hold to scroll functionality
  • Add other functions: sine, cosine, power, etc.

      Now I realize that much of the way I did things was a bit impractical. Creating a separate function to add two values is kinda useless. However, this was meant to be a learning exercise. The code that runs the LCD is still mostly the example code found HERE. I did create the menu and such, and that was really the focus of the exercise. I knew I could do it; I wanted to prove that to myself.

Stuff you might want:


     If you are using my code, note that I make no guarantees that it is perfect. If you are just buying the shield, note that I have a review that might interest you. If you have questions, comments, or concerns, post a comment or send me an email. 

     If you choose to undertake this project, I hope you find it interesting. I don't know that I learned anything specific while working on this, but I honed my debugging skills and such. I think this may be the last of my LCD shield projects for a while. I have one more in mind, but that may wait. I've got my ATtiny's waiting on me as well as my IMU that I have been playing with. So much to do, so little time. Anyway. I hope you found this interesting.

Until later,
Matthew

No comments:

Post a Comment