Julien Buissart Dubois / Mbed 2 deprecated Projet1-EmbSys-DubLet

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "x10rf.h"
00002 
00003 const char house_code[] = { 0x60, 0x70, 0x40, 0x50, 0x80, 0x90, 0xA0, 0xB0, 0xE0, 0xF0, 0xC0, 0xD0, 0x00, 0x10, 0X20, 0x30 } ;
00004 const char unit_code[] = { 0x00, 0x10, 0x08, 0x18, 0x40, 0x50, 0x48, 0x58 } ;
00005 
00006 DigitalOut led(LED1);
00007 DigitalIn button(USER_BUTTON);
00008 
00009 int main()
00010 {
00011     bool appuye = false;
00012     char cmd = ON;
00013     while(1) {
00014         x10rf prot(D14);
00015         
00016         while (button) {
00017             led = 1;
00018             prot.x10_sendcmd('A',11,cmd);
00019             appuye = true;
00020         }
00021         led = 0;
00022         
00023         if (appuye) {
00024             if (cmd == ON)
00025                 cmd = OFF;
00026             else if (cmd == OFF)
00027                 cmd = ON;
00028             appuye = false;
00029         }
00030         
00031         
00032     }
00033 }