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
- Two MPR121 capacitive touchpads are used (one for numbers, the other for operations). More information on this peripheral can be found here: https://developer.mbed.org/users/4180_1/notebook/mpr121-i2c-capacitive-touch-sensor/
- A couple of additional pushbuttons as the uLCD clear function would not behave properly on the touchpad
- uLCD 144 G2 128x128 . More information on this peripheral can be found here: https://developer.mbed.org/users/4180_1/notebook/ulcd-144-g2-128-by-128-color-lcd/
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
Layout
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.