Shuto Naruse
/
Eurobot2012_Beacons
Eurobot2012_Beacons
Diff: main.cpp
- Revision:
- 0:b8be0a00c4f8
- Child:
- 1:b0aa1251016a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Apr 18 21:08:20 2012 +0000 @@ -0,0 +1,38 @@ +#define BEACON_1 +#include "defines.h" +#include "mbed.h" +#include "RF12B.h" + + +PwmOut IRled(p21); + +Serial pc(USBTX, USBRX); // tx, rx + +RF12B RF_Beacon(p5, p6, p7, p11, p14, p20); //RF module + +void turnON (void); +void turnOFF (void); + +// interrupt driven +Timeout toggle; + +char data_in; + +int main() { + RF_Beacon.setCode(CODE); + IRled.period_us(T_CARRIER); + toggle.attach_us(&turnON, 1000); + pc.printf("Beacon Side \n"); + while (1) { + } +} + +void turnON (void) { + IRled.pulsewidth_us(0); // note: the IR led is ON when this is low + toggle.attach_us(&turnOFF, T_CARRIER * ON_CYCLE); +} + +void turnOFF (void) { + IRled.pulsewidth_us(13); // note: the IR led is ON when this is low + toggle.attach_us(&turnON, T_CARRIER * OFF_CYCLE); +} \ No newline at end of file