Step 7: Do Something Cool!
The first thing I did with this was make a simple 3D Tic Tac Toe Interface. If you want to start with a working demo, the code is available here, just drop the folder "TicTacToe3D" in your Processing sketches folder.
Three helpful things that the Tic Tac Toe code demonstrates:
- Linearizes the raw data. The charge time actually follows a power law relative to distance, so you have to take the square root of one over the time (i.e., distance ~= sqrt(1/time))
- Normalizes the data. When you start up the sketch, hold the left mouse button down while moving your hand around to define the boundaries of the space you want to work with.
- Adding "momentum" to the data to smooth out any jitters.
Remove these ads by
Signing Up










































Visit Our Store »
Go Pro Today »




I'm trying to make this work, and it isn't working.
I loaded the code to arduino, and i load the processing code and run it, and all i get is a blank white screen. Please tell me what im doing wrong!
I installed processing and arduino software. I upload sketch to arduino and copied Tic Tac Toe 3D to sketch folder in processing. I'm running processing and I can see window with dimensions of 7x7cm, however I don't see any any points inside the square and I'm not sure how to initialize it. Could you pls help me out? Am I missing something? Thanks a lot for any help!
I have
[0] "/dev/tty.usbmodemfa131"
[1] "/dev/cu.usbmodemfa131"
[2] "/dev/tty.Bluetooth-PDA-Sync"
[3] "/dev/cu.Bluetooth-PDA-Sync"
[4] "/dev/tty.Bluetooth-Modem"
[5] "/dev/cu.Bluetooth-Modem"
from Processing.
I upload to /dev/tty.usbmodemfa131 in Arduino successfully and get good numbers out of the serial monitor there.
When I use a [0] variable for the serial port in Processing however, I get a lot of interference on the serial monitor - not gobbledygook, just weird strings of numbers if varying lengths. I just see the grey cube and nothing else happens.
When I use a [1] variable i get the following error:
RXTX Warning: Removing stale lock file. /var/lock/LK.012.018.043
gnu.io.PortInUseException: Unknown Application
and lots more.
Am I doing anything wrong?
serial = new Serial(this, Serial.list()[serialPort], 115200);
Has anyone solved this yet?
If you were getting that error from the serial line, you have to make sure that the serial variable at the top is the correct serial port. If you look above the error, it should show the serial port that you are using. Mine was com4 so it showed:
[0] "COM4"
Therefore in my situation I had to change the serial variable to 0.
I also got that error randomly sometimes when I would run the program. I think that came from the board sending data before the program starts receiving it and then the program starting halfway through a line. To fix this I just made sure to hit the reset button at the same time I hit run on the processing code and it solved my problem.
Hope that helped :)
I just made the 3d controller and im now trying to make it work. Im new to processing so when I tried to 'just drop the folder TicTacToe3D' in the folder I found under sketch->show sketch folder it wasnt opening. so i just dragged the 3 .pde files on the screen and pressed Run.
This gave an error
in line 54: if(parts.length == sensors) {
'Cannot find anythin named "sensors"'
Does anyone know what is the problem and what is the solution?
Thanks,
change "sensors" to "sen" and it should run.
I have built the board and everything but my problem is with the code. Where exactly is the code for the arduino ?? Or is the program " Processing" code suppose to upload the code into the arduino ?? Sorry if this question seems noob but im really new at this =(
Thank you soo much for any help !!
But shouldnt there be a camera in the code somewhere so i can interact with the TicTacToe game in 3d ??? Where would that code be ??
Sorry once again if my questions seems completely retarded , im really new at all this unfortunately =
there is no camera involved here -- you just need to look at your hand :)
if you want to get a camera involved, you'll have to hack the processing sketch.
for the video i posted, i recorded the camera separately and composited them afterwards, just for demoing how things worked.
It seem that there were two files " Interface" and "Tic Tac Toe " in the download section .
So the interface code goes into the Arduino board and the TicTacToe code goes into Processing ??
Sorry but could you clarify that a little bit ??? Many many thanks for your help !!
Cheers
Pierce