Pages: [1]   Go Down
Author Topic: mega 2560 + Processing  (Read 347 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 70
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hallo,

ich wollte mir die Werte meines Lichtsensors mit Processing grafisch anzeigen lassen. Leider kennt gibt mir Processing immer den Wert "0" aus.
Woran liegts?

Code:
import processing.serial.*;
import cc.arduino.*;

Arduino arduino;

int i = 0;
void setup()
{
  println(Arduino.list());
  arduino = new Arduino(this, Arduino.list()[0], 19200);
  arduino.pinMode(2, Arduino.INPUT);
  size(600, 600);
}

void draw()
{
 
  int iVal = arduino.analogRead(2);
  println(iVal);
  line(i,0,iVal,0);
  delay(1000);
  i++;
 
}


danke
Logged

Forum Moderator
BZ (I)
Offline Offline
Brattain Member
*****
Karma: 271
Posts: 21938
+39 349 2158303
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Welchen Sketch hast Du auf dem Arduino?
Grüße Uwe
Logged

Pages: [1]   Go Up
Jump to: