NAMA KELOMPOK :
1. M TAUFIQ IRVAN E (163600027)2. YULFI AINUN AL F (163600053)
TUJUAN: MENCOBA MENAMPILKAN SENSOR ULTRA SONIC MELALUI LAYAR KALIMAT
PROGRAM :
#include <NewPing.h>
#define terima1 7
#define pancar1 8
#define terima2 2
#define pancar2 4
#define jarakmax 40
NewPing sonar(pancar1, terima1,jarakmax);
NewPing sonar(pancar2, terima2,jarakmax);
void setup() {
Serial.begin (9600);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
}
void LedOn(){
analogWrite(6,HIGH);
analogWrite(5,LOW);
}
void LedOff(){
analogWrite(6,LOW);
analogWrite(5,LOW);
}
void loop() {
unsigned int us=sonar1.ping_cm();
unsigned int us=sonar2.ping_cm();
Serial.print(us);
Serial.println(" Cm ");
delay(50);
}
Bagus 80
BalasHapus