digitalRead() always returning 0

edited December 2013 in Arduino

Im having problems in arduino to processing..im always reading a 0 or LOW output at my command arduino.digitalRead(c), i tested it on normal arduino software, and it works well, i read 0 and 1 once i press the button. here is my code

import processing.serial.*;
import cc.arduino.*;
Arduino arduino;

int c = 4;
int p;
void setup() {
  arduino = new Arduino(this,  Arduino.list()[0], 9600); 
  arduino.pinMode(c, Arduino.INPUT);
}

void draw(){
  p = arduino.digitalRead(c);
  println(p);
}

im using processing 2.1. ATmega328 version of arduino

thanks

Answers

  • edited December 2013

    I tested it and it works, arduino MEGA StandardFirmata //modify Firmata.begin 9600... processing 2.0.3 modify my port//arduino = new Arduino(this, Arduino.list()[1], 9600);

  • I tested it and it works, arduino MEGA StandardFirmata //modify Firmata.begin 9600... processing 2.0.3 modify my port//arduino = new Arduino(this, Arduino.list()[1], 9600);

Sign In or Register to comment.