Book Image

Arduino By Example

By : Adith Jagadish Boloor, Adith Jagdish Boloor
Book Image

Arduino By Example

By: Adith Jagadish Boloor, Adith Jagdish Boloor

Overview of this book

Table of Contents (18 chapters)
Arduino by Example
Credits
About the Author
Acknowledgements
About the Reviewers
www.PacktPub.com
Preface
Index

Tic-tac-toe with touch


Remember how, while using Arduino, you needed to install libraries to make certain functions work? We need to do the same with Processing because it cannot directly communicate with the Arduino. To do this, go to http://playground.arduino.cc/Interfacing/Processing and download the processing2-arduino.zip file. Processing, like Arduino also creates a directory by default in the Documents folder. Extract the downloaded ZIP file to C:\Users\<user>\Documents\Processing\libraries for Windows and Documents/Processing/libraries for Mac and Linux.

Do the same for the matrix library we will be using in the next section from http://pratt.edu/~fbitonti/pmatrix/matrix.zip. Restart Processing.

Note

If you do not have a libraries folder in the Processing directory, go ahead and create a new one.

Now launch the Processing IDE (not the Arduino IDE). Connect the Arduino and run this sketch:

import processing.serial.*;
import cc.arduino.*;

Arduino arduino;
int ledPin = 13;

void setup...