I have a phototransistor and an LED, when I test in Arduino I do get readings from the phototransistor, but when trying to get the same readings in Processing I just get continuous 0’s. Can any one help? I’ve placed the code below. The phototransistor is connected to port A1. Thanks!
import cc.arduino.*;
import org.firmata.*;
import processing.serial.*;
int PhotoPin1 = 1;
Arduino port;
float W= 0;
void setup(){
port= new Arduino(this, Arduino.list()[17], 9600);
port.pinMode(PhotoPin1, Arduino.INPUT);
}
void draw() {
float w_sensorRaw1= port.analogRead(PhotoPin1);
println(w_sensorRaw1);
println(W);
delay(1000);
}