mbed Graphing Calculator

Introduction

Making a graphing calculator using the mbed is not a very difficult process. All it takes is using touch based interrupts combined along with software processing, plus a little bit of uLCD manipulation. In this implementation, we needed

  • A couple of additional pushbuttons as the uLCD clear function would not behave properly on the touchpad

With the addition of a couple pull up resistors, this is as far as it goes with the hardware requirements. The bulk of the work came down to the software processing.

Pinout

http://i.imgur.com/VGWtbrr.png

Layout

http://i.imgur.com/5WZnN0b.png

Code

The code can be broken down into several parts.

  • Various interrupt functions (ie numInterrupt, opInterrupt) are used to input whatever is pressed on the keypads or pushbuttons
  • calculate(string s) is used to take a string of an equation (like 3 + 4) and calculates it returning the integer value, accounting for PEMDAS. Note that in this project only int is used, with default rounding to floor. This is as plotting the pixels would not allow for non int values.
  • graph(string s) takes an equation and graphs it, calling calculate() in a loop as it substitutes a range of values into whereever "x" is found in the equation. It uses uLCD.line() to plot the graph.

Import libraryGraphing Calculator

mbed graphing calculator

Video


Please log in to post comments.