Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MODSERIAL mbed-rtos mbed
Fork of Master by
Diff: main.cpp
- Revision:
- 1:e1cfb5850088
- Parent:
- 0:4f07ba929908
- Child:
- 2:c610e1a7fbcd
--- a/main.cpp Thu Sep 11 10:15:34 2014 +0000 +++ b/main.cpp Thu Sep 11 14:42:49 2014 +0000 @@ -3,34 +3,18 @@ #include "mbed.h" #include "fm.h" #include "bluetooth.h" - -#define red_v 0.01 -#define center_pos 0.80 -#define late_time 0.3 -#define zeroPWM 0.17 +#include "control.h" -//port -Serial pc(USBTX, USBRX); // tx, rx +//BT_MASTER or BT_SLAVE +#define DEVICE_ROLE BT_MASTER -//sensor -AnalogIn Red1(p17); -AnalogIn FSR1(p18); -AnalogIn Red2(p19); -AnalogIn FSR2(p20); +Serial pc(USBTX, USBRX); // tx, rx //debug DigitalOut led1(LED1); DigitalOut led2(LED2); DigitalOut led4(LED4); -//motor -DigitalOut Sig11(p24); -DigitalOut Sig12(p26); -PwmOut Pwm1(p25); -DigitalOut Sig21(p21); -DigitalOut Sig22(p23); -PwmOut Pwm2(p22); - DigitalOut myled1(LED1); DigitalOut myled2(LED2); @@ -41,8 +25,11 @@ int main() { - i2cSetup( 780 ); - btSetupMaster(); + //FM_FREQUENCY is defined in fm.h + unsigned int fm_frequency = DEVICE_ROLE==BT_MASTER ? FM_FREQUENCY1 : FM_FREQUENCY2; + + i2cSetup( fm_frequency ); + btSetup(DEVICE_ROLE); while(1){ /*i2c.start(); i2c.write(0x11);