Shuto Naruse
/
Eurobot2012_Beacons
Eurobot2012_Beacons
main.cpp
- Committer:
- narshu
- Date:
- 2012-04-18
- Revision:
- 0:b8be0a00c4f8
- Child:
- 1:b0aa1251016a
File content as of revision 0:b8be0a00c4f8:
#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); }