#include<LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int trig1=6;
const int echo1=7;
const int trig2=8;
const int echo2=9;
const int trig3=10;
const int echo3=13;
double sure1;
int sure2;
int sure3;
int X;
int Y;
int Z;
[/QUOTE]
int Px,Py,Pz;
burada yer alabilir.
[QUOTE="kaynakkod, post: 751168, member: 289444"]
char d;
void setup()
{
pinMode(trig1,OUTPUT);
pinMode(echo1,INPUT);
pinMode(trig2,OUTPUT);
pinMode(echo2,INPUT);
pinMode(trig3,OUTPUT);
pinMode(echo3,INPUT);
lcd.begin(16,2);
lcd.clear();
Serial.begin(9600);
lcd.display();
}
void loop()
{
for(int o=0; o<200; o++)
{
digitalWrite(trig1,HIGH);
delay(1);
digitalWrite(trig1,LOW);
sure1=pulseIn(echo1,HIGH);
Y=(((sure1/2)/28,5*10)-67)*-1;
digitalWrite(trig2,HIGH);
delay(1);
digitalWrite(trig2,LOW);
sure2=pulseIn(echo2,HIGH);
X=(((sure2/2)/28.5*10)+10);
digitalWrite(trig3,HIGH);
delay(1);
digitalWrite(trig3,LOW);
sure3=pulseIn(echo3,HIGH);
Z=(((sure3/2)/28,5*10)-35);
}
lcd.home();
lcd.clear();
lcd.setCursor(0,0);
lcd.print("X=");
lcd.print(Px);
Serial.println("X=");
Serial.println(X);
lcd.print("mm");
lcd.home();
lcd.setCursor(8.0);
lcd.print("Y=");
lcd.print(Py);
Serial.println("Y=");
Serial.println(Y);
lcd.print("mm");
lcd.home();
lcd.setCursor(0,1);
lcd.print("Z=");
lcd.print(Pz);
Serial.println("Z=");
Serial.println(Z);
lcd.print("mm");
lcd.setCursor(8,1);
lcd.print("PLATE 1");
if(Serial.available()>0)
d=Serial.read();
if(d=='a')
{
Serial.print(X);
Serial.print(Y);
Serial.print(Z);
delay(100);
}
}