SHARE
TWEET

Untitled

a guest Dec 14th, 2019 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Wire.h>
  2. #include <TTP229.h>
  3. #include <HCSR04.h>
  4. #include <BobaBlox.h>
  5.  
  6. TTP229 tastatura;
  7. Photocell fotocelula(pin);
  8. LED albastru(41);
  9. LED galben(39);
  10. LED rosu(43);
  11. Speaker difuzor(pin); //celalalt pin nu gnd ul
  12. int triggerPin = nrpin(scrie pe placa);
  13. int echoPin = 12(scrie pe placa pinul);
  14. UltraSonicDistanceSensor distanceSensor(triggerPin, echoPin);
  15.  
  16.  
  17. void setup() {
  18.   // put your setup code here, to run once:
  19.    Wire.begin();
  20.    Serial.begin(9600);
  21.    while (!Serial) ; // wait for serial port to connect. Needed for native USB
  22.    Serial.println("start: ");
  23.  
  24.  
  25. }
  26.  
  27. void loop() {
  28.   // put your main code here, to run repeatedly:
  29.   tastatura.readKeys();
  30.   int key = tastatura.getKey();
  31.   Serial.print("Taste apasate: ");
  32.   Serial.print(key);
  33.   Serial.println();
  34.   //delay(1000); //delay de o secunda
  35.   if(key = "1234" || int value(fotocelula)<300) //aprindem alarma daca tastam 1234 sau fotocelula inregistreaza o valoare mai mica de 300
  36.      { void off(rosu); //aici e on sau off n am inteles bine din bilbioteca
  37.        double distance = distanceSensor.measureDistanceCm();
  38.        Serial.println(distance);
  39.        if(distance < 25) //daca se apropie la mai putin de 25cm
  40.     {
  41.       void start(difuzor);
  42.       void blink(galben);
  43.       void blink(albastru);
  44.     }
  45.      }
  46.     else if(key = "0000") //aici oprim alarma
  47.     {
  48.       void on(galben); //cred ca e off
  49.     }
  50.    
  51.     Serial.println();
  52.     delay(1000);
  53.  
  54.  
  55. }
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