Use to WIZwiki-W7500, Sensing to PIR motion sensor module(HC-SR501)

Dependencies:   mbed

Fork of PIR_Motion_Sensor_WIZwiki-W7500 by Scott Jeong

Prerequisite

This example is for PIR test using digital I/O.

To implement this function, you need a Platform board, network Interface board.

  • WIZwiki-W7500 from WIZnet (Platform board and Ethernet I/F board)

Hardware Configuration

WIZwiki-W7500 Pin map

pin map

PIR Sensor(HC-501SR) Pin map

pin map

Wiring Table

HC-501SRW7500
VCC5V
GNDGND
SIGNALD8 or PC_7

Software

Init GPIO

DigitalOut myled(LED1); // Alert LED
DigitalIn PIR(PC_7); // PIR Signal   //D8

Get data from PIR

    int PIR_sensor;   // declare variable for PIR input data
    while(1) {
        PIR_sensor = PIR; // Check input signal from PIR pin
        pc.printf("PIR Value : %d\r\n",PIR_sensor);
        myled =! PIR_sensor; // PIR(HIGH) == LED On // PIR(LOW) == LED Off
        wait(0.1f);
    }

Caution

When wiring, be careful (GND, VCC)

Files at this revision

API Documentation at this revision

Comitter:
kei44
Date:
Fri Apr 07 04:15:48 2017 +0000
Parent:
0:9ea50fe6902c
Commit message:
Change PIR PIN for ECO board. (D8 -> PC_7); In fact, two PIN definition is the same.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 9ea50fe6902c -r b8bd8695558d main.cpp
--- a/main.cpp	Mon Jun 29 05:52:26 2015 +0000
+++ b/main.cpp	Fri Apr 07 04:15:48 2017 +0000
@@ -2,7 +2,7 @@
 #include "mbed.h"
 
 DigitalOut myled(LED1);
-DigitalIn PIR(D8);
+DigitalIn PIR(PC_7);  //D8
 
 Serial pc(USBTX, USBRX);
 
diff -r 9ea50fe6902c -r b8bd8695558d mbed.bld
--- a/mbed.bld	Mon Jun 29 05:52:26 2015 +0000
+++ b/mbed.bld	Fri Apr 07 04:15:48 2017 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/7cff1c4259d7
\ No newline at end of file
+https://mbed.org/users/mbed_official/code/mbed/builds/856d2700e60b
\ No newline at end of file