Running your sketch on an Android device
As you are reading this chapter, you probably want to get started with the exciting stuff, and run your sketches on your Android device. The Android Emulator is great for testing, but if you run your app on a real device, you have access to the accelerometer, the GPS, or the touchscreen. Let's take a look at how you can install your sketches on your device.
How to do it...
To run a sketch on your device, you first need to enable USB debugging. To do this, go to Settings | Applications | Development on your device, and touch the checkbox next to USB debugging:
We'll use the same code as in the previous recipe. Here it is again:
float x; float y; float prevX; float prevY; float d; float h; void setup() { size( displayWidth, displayHeight ); background( 0 ); smooth(); x = random( width ); y = random( height ); prevX = x; prevY = y; stroke( 255, 128 ); colorMode( HSB, 360, 100, 100, 100 ); } void draw() { x += random( -30, 30...