Pages: [1]   Go Down
Author Topic: Hello good day.  (Read 476 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What is loaded on the Arduino when that Processing code is running?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

there is no loaded code on arduino, because what i understand is that i am already acessing my arduino with the processing software. maybe im wrong..should i load a code on my arduino first?

sorry for my bad english
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
should i load a code on my arduino first?
Of course. There must be something there for Processing to talk to. The Processing application is expecting you to have loaded one of the Firmata sketches on to the Arduino.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

oh i see, thanks..well i think this kinda spoon feeding but what should i load on my arduino?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks you sir, i already understand what you were saying really thank you so much smiley
Logged

Pages: [1]   Go Up
Jump to: