Loading...
Pages: [1]   Go Down
Author Topic: get distance with ez0 sensor + arduino + processing  (Read 49 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

HI, I'm trying to figure out how to code in processing to read values from my distance sensor  Maxbotix LV EZ-0 and EZ-4 and have the values change an image on the screen. I am running a simple program to display sensor values from each of the two sonars in arduino but i cann't found the appropriate code in Processing.
// Arduino code for reading sensor values from  Maxbotix LV EZ-0 and EZ4 Sensors
int pwEZ0 = 8;
int pwEZ4 = 7;

long pulseEZ0, cmEZ0 ;
long pulseEZ4, cmEZ4 ;

void setup()
{
Serial.begin(9600);
}

void loop() {
  pinMode(pwEZ0, INPUT);
 
pulseEZ0 = pulseIn(pwEZ0, HIGH);
  cmEZ0 =pulseEZ0/147;
 
  Serial.println(cmEZ0);
 
  delay(500);

  pinMode(pwEZ4, INPUT);
 
  pulseEZ4 = pulseIn(pwEZ4, HIGH);
 cmEZ4= pulseEZ4/147;
 
  Serial.println(cmEZ4);
 
  delay(500);
}

Any help is much appreciated.  Thanks!
Logged

Pages: [1]   Go Up
Print
 
Jump to: