Hardware Reference
In-Depth Information
Pick which analog-in to use.
Pick where on the web page to draw the plot. In this case, the code defines only one
place,
myplot
.
Decide how many points can be plotted.
Set various plotting options.
Initialize the plot.
Draw the graph on the web page.
Set the data and draw. Then read the next value and call
onAnalogRead
when it's
ready.
If no error, add newest value to the data array.
Do it all over again in 20 ms.
Plotting locally
You can do plotting locally by following the process in
Recipe 6.6
:
1. Copy the JavaScript code in the lower-left panel and save it in a file called
flotDemo.js
.
2. Copy the HTML in the upper-left panel and add the header material.
Example 6-6
loads the
flot
library in addition to
jquery
and our own code.