ルンバハック用.

Dependencies:   mbed

cmd_Transmitter.cpp

Committer:
naoki_westwell
Date:
2016-06-24
Revision:
0:ac1e1657002a

File content as of revision 0:ac1e1657002a:

#include "mbed.h"
#include <System_Select.h>

#ifdef CMD_TRANSMITTER

Serial Device(p9, p10);
DigitalIn SW(p17);
//Serial pc(USBTX, USBRX); // tx, rx

void send_cmd(char commnad);

int main() {
    Device.baud(115200);
    int cnt1 = 0, cnt2 = 0;
    
    while(1){
        if(cnt1==1){
            send_cmd(START);    //  OI ON and start cleaning
            //send_cmd(SAFE); 
            send_cmd(CLEAN); 
            cnt2 = 0;
        }
        if(cnt2==1){
            send_cmd(BUTTONS);    // 
            send_cmd(0x01);    // 
            cnt1 = 0;
        }
        
        if(SW) cnt1++;
        else cnt2++;
    }
}

void send_cmd(char command){
    Device.putc(command);
}

#endif