Pages: [1]   Go Down
Author Topic: Processing via Firmata digitalRead on Mega pins >15  (Read 1380 times)
0 Members and 1 Guest are viewing this topic.
Saskatoon, SK, Can.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello all,

I'm new to this forum, but have spent I bit of time using the Arduino.

I think the Arduino library (for the Mega) requires updating. I've found it to work very well except for the digitalRead() on pins greater than 15 on the Mega (I'm using the atmega 1280). Here is what I have:

- ArduinoMega (1280) loaded with StandardFirmata
- Tested with firmata test program http://firmata.org/wiki/Main_Page (all functionality works)
       - This tells me the problem lies in the Arduino processing library
- I downloaded the Arduino library from http://nilseuropa.com/?p=139 as the one here http://www.arduino.cc/playground/Interfacing/Processing has an empty library folder (both src folders including the .java file appear identical).
- All PWM pins (2-13) work
- digitalWrite(int,int) works for all pins (2-53)
- digitalRead(int) only works with pins 2-15

My guess is that the problem is in the Arduino.java code.  I am not an experienced programmer, and have never touched Java.

If anyone is interested in helping solve this bug let me know.

Cheers,

Tyler

Here is the processing sketch I am using to test the digitalRead and simply jumping to test the hardware:
Code:
import processing.serial.*;

import cc.arduino.*;

Arduino arduino;

color off = color(4, 79, 111);
color on = color(84, 145, 158);

void setup() {
  size(470, 280);
  arduino = new Arduino(this, Arduino.list()[1], 57600);
  
  for (int i = 2; i <= 53; i++)
    arduino.pinMode(i, Arduino.INPUT);
}

void draw() {
  background(off);
  stroke(on);
  
  for (int i = 2; i <= 53; i++) {
    if (arduino.digitalRead(i) == Arduino.HIGH)
      fill(on);
    else
      fill(off);
      
    rect(420 - i * 10, 20, 10, 10);
  }
}
« Last Edit: March 28, 2011, 05:45:41 pm by mechanicallogos » Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 634
Posts: 34541
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
My guess is that the problem is in the Arduino.java code
No the problem is with the Standard Firmata software, it has not been extended to cover all the Mega's pins.
Logged

Saskatoon, SK, Can.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That's what I initially thought, but why would the Firmata test program be able to read input's?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 24
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi


it looks, like I got the same problem. When I work with the Firmata test, I can read from every pin, like 53...

But when I try to read within my own Processing Script, I get no input?

Has there been any solution?


Thank you
n
Logged

Pages: [1]   Go Up
Jump to: