Hardware Reference
In-Depth Information
WritingtheProcessingSketch
At this point, your Arduino is already transmitting easy-to-parse data to your
computer. All you need to do is write a Processing program that can interpret
it and display it in an attractive way.
Because you'll be updating text in real time, you need to first learn how to
load fonts into Processing. Open Processing to create a new, blank sketch. Save
the sketch before continuing. Then, navigate to Tools > Create Font. You'll get
a screen that looks like Figure 8-9.
Figure 8-9: Processing font creator
Pick your favorite font and choose a size. (I recommend a size around 200 for
this exercise.) After doing so, click OK. The font is then automatically gener-
ated and added to the “data” subfolder of your Processing sketch folder. The
Processing sketch needs to accomplish a few things:
Generate a graphical window on your computer showing the temperature
in both Celsius and Fahrenheit.
Read the incoming data from the serial port, parse it, and save the values
to local variables that can be displayed on the computer.
Continually update the display with the new values received over serial.
Search WWH ::




Custom Search