Question

I'm a newcomer to Arduino, and I'm trying to use Processing to control my Arduino Uno board relying on Firmata library. However after quick test, I can't seem to be able to light up my LED when using analog pins from A0 to A5, while it works without any problem for digital pins 0 - 13. Using Arduino directly works without any issue for all 19 pins.

void setup() {
    arduino = new Arduino(this, "/dev/tty.usbmodem1411" );

    for( int i = 0; i < 20; i++ ) // in Arduino A0 is pin 14, but to be sure I also tried in processing pin 16, just in case if A0 is 0xA0
        arduino.pinMode( i, Arduino.OUTPUT );

}

void draw() {
    for( int i = 0; i < 20; i++ ) { // quick and dirty mode to test all LEDs
        arduino.digitalWrite( i, Arduino.HIGH );
        arduino.analogWrite( i, 255 );
    }
}

Currently I'm using SainSmart UNO board, and the reason I'm using processing because I need to access higher level libraries which are only available at processing for now.

Does anyone know how to code so that I can use Processing to access the analog pins on the Arduino board ?

Was it helpful?

Solution

It might be good idea to turn Analog Inputs as INPUTS in Firmata sketch inside Arduino.

void setup()
{
pinMode(A0, OUTPUT);    // <- like this...

Firmata.setFirmwareVersion(0, 1); //... and then go on with standard firmata
Firmata.begin();
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top