Hardware Reference
In-Depth Information
To enable the PHP script to write to the datalog
file, you'll first need to create the file on your
server. Make a blank text file called datalog.
txt in the same directory as the PHP script (in the Linux
or Mac OS X Terminal, you can use the command touch
datalog.txt ). Change its permissions so that it's readable
and writable by others. From the command line of a Linux
or Mac OS X system, type:
http://www.yourserver.com/logger.php?data=blahblahblah
You should get a page that looks like Figure 10-23. Open
the datalog.txt file. You'll see something like this:
blahblahblah
blahblahblah
blahblahblah
If you do, you know everything is working and you're ready
to write the Processing sketch.
X
chmod o+rw datalog.txt
If you're creating the file using a GUI-based program, get
info on the file and set the permissions that way. Figure
10-24 shows the Get Info window from BBEdit, which is
similar to many other programs. Once you've made this
file, call it from the browser with a query string like this:
Figure 10-24
Setting the read-write permissions for a file
from a GUI-based program.
Bluetooth Serial Library
In order to use the Processing for Android sketch, you'll
need the Bluetooth Serial (BtSerial) library. This library
allows you to make serial connections over Bluetooth
using similar commands to those you used with the serial
library in Processing's Standard mode. You can download
it from https://github.com/arduino/BtSerial . Click the
Downloads link and pick the latest download package
(0.1.6 as of this writing). Make sure to download the
download package not the source. Unzip the file. You'll
get a directory called btserial-0.1.6. Inside it is a directory
called btserial. Place that in the libraries folder of your
Processing sketch directory, as you've done with other
libraries.
In Android mode in Processing version 1.5.1, libraries are
not always imported into your sketch automatically. This
will be fixed in future versions so that it works like the
Standard mode. If when you try to run your sketch you get
an error that says package cc.arduino.btserial does not
exist , make a subdirectory, code, in the sketch's directory
and copy the file btserial.jar from the library subdirectory of
the btserial directory that you just installed into code. Then
try running your sketch again.
This is not ideal, but it should be addressed by the time
this topic is in publication—the Processing team is very
good with bug fixes.
X
 
Search WWH ::




Custom Search