Sonar_Beacon

Dependencies:   mbed RF12B

Committer:
xiaxia686
Date:
Wed Mar 21 22:09:56 2012 +0000
Revision:
0:bc5045987df8

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
xiaxia686 0:bc5045987df8 1 #include "mbed.h"
xiaxia686 0:bc5045987df8 2 #include "RF12B.h"
xiaxia686 0:bc5045987df8 3 //#include "SRF05.h"
xiaxia686 0:bc5045987df8 4 #define CODE 0x88
xiaxia686 0:bc5045987df8 5
xiaxia686 0:bc5045987df8 6 DigitalOut Led_1(LED1);
xiaxia686 0:bc5045987df8 7 DigitalOut trigger(p13);
xiaxia686 0:bc5045987df8 8
xiaxia686 0:bc5045987df8 9 Serial pc(USBTX, USBRX); // tx, rx
xiaxia686 0:bc5045987df8 10
xiaxia686 0:bc5045987df8 11 RF12B RF_Beacon(p5,p6,p7,p8,p9);
xiaxia686 0:bc5045987df8 12
xiaxia686 0:bc5045987df8 13 char data_in;
xiaxia686 0:bc5045987df8 14
xiaxia686 0:bc5045987df8 15 int main() {
xiaxia686 0:bc5045987df8 16 pc.printf("Beacon Side \n");
xiaxia686 0:bc5045987df8 17 while (1) {
xiaxia686 0:bc5045987df8 18 data_in=RF_Beacon.read();
xiaxia686 0:bc5045987df8 19 if (data_in == (char) CODE) {
xiaxia686 0:bc5045987df8 20 Led_1 = 1;
xiaxia686 0:bc5045987df8 21 trigger = 1;
xiaxia686 0:bc5045987df8 22 wait_us(10);
xiaxia686 0:bc5045987df8 23 trigger = 0;
xiaxia686 0:bc5045987df8 24 pc.printf("%x \n",data_in);
xiaxia686 0:bc5045987df8 25 Led_1 = 0;
xiaxia686 0:bc5045987df8 26
xiaxia686 0:bc5045987df8 27 }
xiaxia686 0:bc5045987df8 28
xiaxia686 0:bc5045987df8 29 }
xiaxia686 0:bc5045987df8 30 }