Differences

This shows you the differences between two versions of the page.

Link to this comparison view

pm:prj2021:abasoc:litierainteligenta [2021/05/01 20:41]
olivia_maria.oprea
pm:prj2021:abasoc:litierainteligenta [2021/05/30 22:18] (current)
olivia_maria.oprea [Jurnal]
Line 39: Line 39:
 Am ales sa folosesc drept mediu de dezvoltare **Arduino IDE**. \\ Am ales sa folosesc drept mediu de dezvoltare **Arduino IDE**. \\
 \\ \\
-TODO+^__Librari necesare:__ ^ 
 +|-> #include <​SPI.h>​ | 
 +|-> #include <​nRF24L01.h>​ | 
 +|-> #include <​RF24.h>​ | 
 +<note tip> Libraria NRF se poate gasi si aici: https://​github.com/​nRF24/​RF24 </​note>​ 
 +    COD MASTER 
 +    #include <​SPI.h>​ 
 +    #include <​nRF24L01.h>​ 
 +    #include <​RF24.h>​ 
 +    RF24 nrf(9, 8);  // CE, CSN 
 +     
 +    const byte linkAddress[6] = "​link1";​ // address through which two modules communicate. 
 +    int IRSensor = 2; // connect ir sensor to arduino pin 2 
 +    boolean state = 0; 
 +     
 +    void setup() { 
 +      // put your setup code here, to run once: 
 +      pinMode (IRSensor, INPUT); // sensor pin INPUT 
 +       
 +      Serial.begin(9600);​ 
 +      Serial.println("​MASTER:​ Starting"​);​ 
 +       
 +      nrf.begin(); ​   
 +      nrf.openWritingPipe(linkAddress); ​ // set the address  
 +      nrf.setPALevel(RF24_PA_HIGH);​  
 +      nrf.stopListening(); ​ // act as a transmitter 
 +    } 
 +     
 +    void loop() { 
 +      // put your main code here, to run repeatedly:​ 
 +      int statusSensor = digitalRead (IRSensor);​ 
 +     
 +      if (statusSensor == 1){ 
 +        state = 1; 
 +        Serial.print("​MASTER:​ Nu se intampla nimic"​);​ 
 +        nrf.write(&​state,​ sizeof(state));​ // send message to receiver 
 +      } else { 
 +        state = 0; 
 +        Serial.print("​MASTER:​ A venit pisicuta"​);​ 
 +        nrf.write(&​state,​ sizeof(state));​ // send message to receiver 
 +      } 
 +      delay(100);​ 
 +    }   
 +\\ 
 +    COD SLAVE 
 +    #include <​SPI.h>​ 
 +    #include <​nRF24L01.h>​ 
 +    #include <​RF24.h>​ 
 +    RF24 nrf(9, 8);  // CE, CSN 
 +     
 +    const byte linkAddress[6] = "​link1"; ​ // address through which two modules communicate. 
 +    boolean state = 0; 
 +    const byte redLED1 = 7; 
 +    const byte redLED2 = 6; 
 +    const byte redLED3 = 5; 
 +    const byte redLED4 = 4; 
 +    const byte redLED5 = 3; 
 +     
 +    void setup() { 
 +      // put your setup code here, to run once: 
 +      pinMode(redLED1,​ OUTPUT); 
 +      pinMode(redLED2,​ OUTPUT); 
 +      pinMode(redLED3,​ OUTPUT); 
 +      pinMode(redLED4,​ OUTPUT); 
 +      pinMode(redLED5,​ OUTPUT); 
 +       
 +      Serial.begin(9600);​  
 +      Serial.println("​SLAVE:​ Starting"​);​ 
 +     
 +      nrf.begin(); ​    
 +      nrf.openReadingPipe(0,​ linkAddress); ​ // set the address  
 +      nrf.setPALevel(RF24_PA_HIGH);​ 
 +      nrf.startListening(); ​  // set nrf as receiver 
 +    } 
 +     
 +    void loop() { 
 +      // put your main code here, to run repeatedly:​ 
 +      if (nrf.available()){ ​ // read the data if available in buffer 
 +         ​nrf.read(&​state,​ sizeof(state));​ 
 +         if (state == 1) { 
 +          digitalWrite(redLED1,​ LOW); 
 +          digitalWrite(redLED2,​ LOW); 
 +          digitalWrite(redLED3,​ LOW); 
 +          digitalWrite(redLED4,​ LOW); 
 +          digitalWrite(redLED5,​ LOW); 
 +           
 +          Serial.print("​SLAVE:​ Nu se intampla nimic"​);​ 
 +         } else { 
 +          digitalWrite(redLED1,​ HIGH); 
 +          delay(20);​ 
 +          digitalWrite(redLED1,​ LOW); 
 +          digitalWrite(redLED2,​ HIGH); 
 +          delay(20);​ 
 +          digitalWrite(redLED2,​ LOW); 
 +          digitalWrite(redLED3,​ HIGH); 
 +          delay(20);​ 
 +          digitalWrite(redLED3,​ LOW); 
 +          digitalWrite(redLED4,​ HIGH); 
 +          delay(20);​ 
 +          digitalWrite(redLED4,​ LOW); 
 +          digitalWrite(redLED5,​ HIGH); 
 +          delay(20);​ 
 +          digitalWrite(redLED5,​ LOW); 
 +           
 +          Serial.print("​SLAVE:​ A venit pisicuta"​);​ 
 +         } 
 +      }   
 +      delay(100);​ 
 +    } 
 +\\
  
 ====== Rezultate Obținute ====== ====== Rezultate Obținute ======
-TODO+Se poate vedea o scurta demonstratie aici: https://​youtu.be/​Phm82yrZL-k
  
 ====== Concluzii ====== ====== Concluzii ======
 Dupa acest proiect pisica nu a fost prea fericita sa coopereze. \\ Dupa acest proiect pisica nu a fost prea fericita sa coopereze. \\
-{{ :​pm:​prj2021:​abasoc:​paris_supi.jpg?150 }} \\+{{ :​pm:​prj2021:​abasoc:​paris_supi.jpeg?100 }} \\ 
 +Cu toate acestea, litiera inteligenta este complet functionala si gata de utilizare. ​\\
  
 ====== Download ====== ====== Download ======
-<note tip>​Documentatia in format PDF: {{ :​pm:​prj2021:​abasoc:​litiera_inteligenta_ollie.pdf }} \\+<note tip>​Documentatia in format PDF part1: {{ :​pm:​prj2021:​abasoc:​litiera_inteligenta_ollie.pdf }} \\ 
 +Documentatia in format PDF part2: {{ :​pm:​prj2021:​abasoc:​litiera_inteligenta_p2.pdf }} \\
 Link pagina: https://​ocw.cs.pub.ro/​courses/​pm/​prj2021/​abasoc/​litierainteligenta</​note>​ Link pagina: https://​ocw.cs.pub.ro/​courses/​pm/​prj2021/​abasoc/​litierainteligenta</​note>​
  
Line 56: Line 167:
 27 Aprilie -> au sosit toate piesele necesare realizarii proiectului \\ 27 Aprilie -> au sosit toate piesele necesare realizarii proiectului \\
 01 Mai -> implementare proiect \\ 01 Mai -> implementare proiect \\
 +30 Mai -> finalizare proiect \\
  
 ====== Bibliografie/​Resurse ====== ====== Bibliografie/​Resurse ======
 Diagrama bloc -> https://​www.lucidchart.com ​ \\ Diagrama bloc -> https://​www.lucidchart.com ​ \\
-Schema electrica -> https://​easyeda.com ​ \\ 
 Schema cablaj -> https://​fritzing.org ​ \\ Schema cablaj -> https://​fritzing.org ​ \\
 nRF24L01 datasheet -> https://​www.mouser.com/​datasheet/​2/​297/​nRF24L01_Product_Specification_v2_0-9199.pdf \\ nRF24L01 datasheet -> https://​www.mouser.com/​datasheet/​2/​297/​nRF24L01_Product_Specification_v2_0-9199.pdf \\
pm/prj2021/abasoc/litierainteligenta.1619890865.txt.gz · Last modified: 2021/05/01 20:41 by olivia_maria.oprea
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0