daily pastebin goal
55%
SHARE
TWEET

Untitled

a guest Oct 11th, 2018 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Ultrasonic.h>
  2.  
  3. Ultrasonic ultrasonico1(12, 11); //pines triger12 / echo1 (FRONTAL)
  4.  
  5.  
  6. float dist1=0; //variables tipo float para almacenar la lectura del sensor
  7.  
  8.  
  9. void setup() {
  10.   Serial.begin(9600);
  11.   pinMode(8,OUTPUT);
  12. }
  13.  
  14. void loop() {
  15.   sensor1();
  16.  
  17. }
  18.  
  19. void sensor1(){
  20.   dist1=ultrasonico1.distanceRead();
  21.   if(dist1 <= 70){digitalWrite(8,1);
  22.   delay(500);
  23.   digitalWrite(8,0);
  24.   }
  25.   else{return sensor1();}
  26.  
  27. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top