![](/media/cache/group/mehmet_akif_arvas.jpg.50x50_q85.jpg)
guvenlik sistemi
Dependencies: mbed wave_player mbed-rtos MFRC522 SDFileSystem TextLCD keypad DHT11
Revision 1:f01aa6d55b26, committed 2019-05-22
- Comitter:
- marvas
- Date:
- Wed May 22 11:08:14 2019 +0000
- Parent:
- 0:d20cd68db570
- Commit message:
- guvenlik sistemi
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DHT11.lib Wed May 22 11:08:14 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/s_inoue_mbed/code/DHT11/#e91c151d1798
--- a/main.cpp Tue May 21 11:50:19 2019 +0000 +++ b/main.cpp Wed May 22 11:08:14 2019 +0000 @@ -6,6 +6,17 @@ #include <string.h> #include <iostream> #include "SDFileSystem.h" +#include "DHT11.h" +#include "wave_player.h" +//Thread sicaklik; +//https://audio.online-convert.com/convert-to-wav +Timer isizaman; + volatile char deger;//değişken bütün bloklarda kullanılabilecek şekle geldi. Public yapıldı + DHT11 isi(D9); + +AnalogOut DACout(PA_4); +wave_player waver(&DACout); + SDFileSystem sd(PC_12, PC_11, PC_10, PD_2, "sd"); // mosi, miso, sclk, cs(scl) DigitalOut lamba(PA_13);//sinyal pini pa_13 DigitalOut klima(PA_14); @@ -13,7 +24,6 @@ float ldroku; unsigned char c; -Thread btt; Serial pc(USBTX,USBRX); Serial bt(A0,A1); char gelen[10]={0}; ;//10 adet kapasiteli değişken tanımlandı @@ -48,6 +58,10 @@ void girismetot() { + FILE *wave_file; + wave_file=fopen("/sd/hosgeldiniz.wav","r"); + waver.play(wave_file); + fclose(wave_file); time_t seconds = time(NULL); lamba=0; lcd.cls(); @@ -71,16 +85,19 @@ lamba=1; else lamba=0; - + if(deger>30) + klima=1; + else + klima=0; //sd karta yazma - FILE *fp = fopen("/sd/ornek.txt", "w"); + FILE *fp = fopen("/sd/ornek.txt", "a"); if(fp == NULL) { error("Yazma icin dosya acilamadi \n"); } else { - fprintf(fp, "%s,%x",ctime(&seconds),RfChip.uid.uidByte[0]); + fprintf(fp, "%s,\n Giris yapan: %X,%X,%X,%X",ctime(&seconds),RfChip.uid.uidByte[0],RfChip.uid.uidByte[1],RfChip.uid.uidByte[2],RfChip.uid.uidByte[3]); fclose(fp); //Dosya kapat @@ -100,12 +117,24 @@ fclose(fpr); } } +/* +void sicaklikmetodu() +{ + while(1) + { + deger = isi.readData(); + pc.printf("T:%d, H:%d\r\n", isi.readTemperature(), isi.readHumidity()); + wait(2); + } + }*/ int main(void) { //set_time(1558438679); - + isizaman.start(); pc.baud(38400); bt.baud(38400); + wait(1); + //sicaklik.start(sicaklikmetodu); mkdir("/sd", 0777); Keypad key(PC_4, PB_13, PB_14, PB_15, PB_1, PB_2, PB_12, PA_11); uint32_t key_num; @@ -116,8 +145,11 @@ while ((key_num = key.read()) != 0) { sifre[sayac]=*(key_table + key_num-1); + + lcd.locate(sayac,1); + lcd.printf("*"); sayac++; - lcd.printf("*"); + if(sayac==3) if(sifre[0]=='1' && sifre[1]=='2' && sifre[2]=='3' && sifre[3]=='A') { girismetot(); @@ -130,13 +162,23 @@ // Look for new cards if ( ! RfChip.PICC_IsNewCardPresent()) { time_t seconds = time(NULL); - while(pc.readable()>0 ){//seri portta veri varmı? + if(pc.readable()>0 ){//seri portta veri varmı? veri=pc.getc(); - pc.printf("%s",veri); + pc.printf("%c",veri); /*pc.scanf("%s",gelen); pc.printf("%s \n",gelen);*/ } + + if(isizaman.read()>2) + { + + lcd.locate(0,0); + deger = isi.readData(); + lcd.printf("ISI:%d, NEM:%d", isi.readTemperature(), isi.readHumidity()); + lcd.printf(" "); + isizaman.reset(); + } continue; } @@ -164,6 +206,6 @@ // Print Card type uint8_t piccType = RfChip.PICC_GetType(RfChip.uid.sak); printf("PICC Type: %s \n\r", RfChip.PICC_GetTypeName(piccType)); - wait_ms(500); + } } \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wave_player.lib Wed May 22 11:08:14 2019 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/sravet/code/wave_player/#acc3e18e77ad