Small prototype for home automation using capacitive touch switches.
Fork of PIR_Motion_Sensor_WIZwiki-W7500 by
main.cpp
- Committer:
- shia
- Date:
- 2016-09-17
- Revision:
- 1:55d45a5f9262
- Parent:
- 0:9ea50fe6902c
File content as of revision 1:55d45a5f9262:
// Capacitive touch Modlue for home automation // // Things you require to do this project are Wiz Wiki 7500 board, TTP224 4-way Switch Touch Sensor Capacitive Digital Touch Sensor Module FZ0714, //few connecting wires //connections are as follows // 5V and GND for both the boards //OUT 1 = D8 //OUT 2 = D7 //OUT 3 = D6 //OUT 4 = D5 // To make it more effective connect a relay controller board and configure some i/o lines instead of LED's in the wiznet board........... #include "mbed.h" DigitalOut myled1(LED1); DigitalOut myled2(LED2); DigitalOut myled3(LED3); DigitalIn sw1(D8); DigitalIn sw2(D7); DigitalIn sw3(D6); DigitalIn sw4(D5); Serial pc(USBTX, USBRX); int main() { pc.baud(9600); wait(0.5f); pc.printf(" GSAS Micro Systems Pvt Ltd \n\r"); pc.printf("===========================================\n\r"); int sensor1; int sensor2; int sensor3; int sensor4; while(1) { // 1st switch // to toggle switch 1 sensor1 = sw1; // pc.printf("sw1 Value : %d\r\n",sensor1); if (sensor1 == 1) { pc.printf("\nHELLO THERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!! you have pressed SWITCH 1\n\r"); myled1 =!myled1; wait(0.3f); } // 2nd switch // to toggle switch 2 sensor2 = sw2; // pc.printf("sw2 Value : %d\r\n",sensor2); if (sensor2 == 1) { pc.printf("\nHELLO THERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!! you have pressed SWITCH 2\n\r"); myled2 =!myled2; wait(0.3f); } // 3rd switch // to toggle switch 3 sensor3 = sw3; // pc.printf("sw3 Value : %d\r\n",sensor3); if (sensor3 == 1) { pc.printf("\nHELLO THERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!! you have pressed SWITCH 3\n\r"); myled3 =!myled3; wait(0.3f); } // 4th switch //to switch OFF all the devices sensor4 = sw4; if (sensor4 == 1) { pc.printf("\nAll devices are turned OFF\n\r"); myled1 = 1; myled2 = 1; myled3 = 1; // wait(0.3f); } // //wait(0.1f); } }