Arduino digitalRead and digitalWrite don't work
in
Integration and Hardware
•
2 years ago
hi everybody,
I'm having problems with Arduino and Processing working together, i upload the StandardFirmata on the board and when i write something on Processing to use the analog pins works fine, but when it comes to the digitalRead or digitalWrite they don't work. If i try with Firmata test, everything works, the digital values go high and low but when it comes to Processing it doesn't.
This is a simple code that i wrote to try digitalRead and digitalWrite on processing, maybe i've been typing something wrong. The monitor keeps showing "0" also if i press the button, and the LED is off. I've tried the same on the Arduino IDE and it works. Another thing is that every time that i stop processing, Leopard says that my_sketch crashes after the use of the librxtxSerial.jnilib plugin.
I'm having problems with Arduino and Processing working together, i upload the StandardFirmata on the board and when i write something on Processing to use the analog pins works fine, but when it comes to the digitalRead or digitalWrite they don't work. If i try with Firmata test, everything works, the digital values go high and low but when it comes to Processing it doesn't.
This is a simple code that i wrote to try digitalRead and digitalWrite on processing, maybe i've been typing something wrong. The monitor keeps showing "0" also if i press the button, and the LED is off. I've tried the same on the Arduino IDE and it works. Another thing is that every time that i stop processing, Leopard says that my_sketch crashes after the use of the librxtxSerial.jnilib plugin.
- import processing.serial.*;
import cc.arduino.*;
Arduino arduino;
int ledPin = 13;
int butPin = 8;
void setup(){
arduino = new Arduino(this, Arduino.list()[0], 57600);
arduino.pinMode(ledPin, Arduino.OUTPUT);
arduino.pinMode(butPin, Arduino.INPUT);
}
void draw() {
int b = arduino.digitalRead(butPin);
println(b);
arduino.digitalWrite(ledPin, arduino.HIGH);
}
1