Quantcast
Channel: Arduino - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 747

arduino.pulseIn(int,int) and Processing

$
0
0

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

Arduino arduino;

int l = 0; int r=-180; int t; float z;

void setup() { frameRate(40); size(500, 500); println(Arduino.list()); arduino = new Arduino(this, Arduino.list()[0], 57600); arduino.pinMode(10, Arduino.SERVO); arduino.pinMode(8, Arduino.INPUT); }

void draw() { translate(250, 250); background(250); screen();

strokeWeight(3); stroke(0, 255, 0); strokeWeight(2); if (l>=-181 ) { l--; t=1; z = radians(l); } if (l<-180) { r++; t=r; z = radians(r); } if (r==0) { r=-180; l=0; }

pushMatrix(); rotate(z); line(0, 0, 100, 0); popMatrix(); }

void screen() { stroke(0); fill(0); arc(0, 0, 200, 200, PI, TWO_PI); }

void ar(){ arduino.servoWrite(10, t);
arduino.digitalWrite(8, Arduino.HIGH); arduino.pulseIn(8, Arduino.HIGH); }`

pulseIn(int,int); is not a function, Can I add this to the arduino library or would it not work for processing even if added? Or is there another way to use a ping sensor in processing?


Viewing all articles
Browse latest Browse all 747

Latest Images

Trending Articles



Latest Images