I have recreated this little circuit: http://arduinobasics.blogspot.com/2011/06/arduino-uno-photocell-sensing-light.html
which just sends the output of a photocell to the A0 analog pin on the Arduino. All I want to do is read this value and display it on my screen with Processing. I did this successfully without Firmatta, but I'll need to do some more complex interactions later on and need to use Firmatta for communications.
The problem is that the analogRead function doesn't seem to work - the value stays at 0 and doesn't change. Here is my code:
In setup, I initiate the arduino and set the pin mode:
arduino = new Arduino(this, Arduino.list(), 57600);
I have tried changing the pin number to 16 (no change), and the mode to ANALOG and OUTPUT (no change).
In draw, I write some text to the screen with the value from analogRead:
text("Sensor Reading: " + arduino.analogRead(0), width/20, height/2);
I tried changing the pin number to 16 here, but that crashes the app with the error ArrayIndexOutOfBoundsException.
What is the issue? I feel like I have tried all the combinations of possible parameters - is there some setup step I am missing?