WIZnet / Mbed 2 deprecated PIR_Motion_Sensor_WIZwiki-W7500

Dependencies:   mbed

Fork of PIR_Motion_Sensor_WIZwiki-W7500 by Scott Jeong

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 // PIR Motion Sensor Modlue : HC-SR501
00002 #include "mbed.h"
00003 
00004 DigitalOut myled(LED1);
00005 DigitalIn PIR(PC_7);  //D8
00006 
00007 Serial pc(USBTX, USBRX);
00008 
00009 int main() {
00010     pc.baud(115200);
00011     wait(0.5f);
00012     pc.printf("Hello WizWIki-W7500!\n\r");
00013     pc.printf("===========================================\n\r");
00014     int PIR_sensor;
00015     while(1) {
00016         PIR_sensor = PIR;
00017         pc.printf("PIR Value : %d\r\n",PIR_sensor);
00018         myled =! PIR_sensor;
00019         wait(0.1f);
00020     }
00021 }