Fan Control Demo

Dependencies:   mbed-rtos mbed

Fork of mbed_fota by KIM HyoengJun

Committer:
dudnwjs
Date:
Mon Jul 20 09:22:15 2015 +0000
Revision:
7:3478c46cceef
Parent:
6:8dd20294b2aa
Child:
8:9eec2c246a85
Complete demo application

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dudnwjs 0:a1f6b1ba8a1e 1 #include "mbed.h"
dudnwjs 1:5cf3a6c969be 2 #include "BleMsgHandler.h"
dudnwjs 3:1e70387e1337 3 #include "app.h"
dudnwjs 0:a1f6b1ba8a1e 4
dudnwjs 0:a1f6b1ba8a1e 5 Serial hostpc(USBTX,USBRX);
dudnwjs 0:a1f6b1ba8a1e 6 Serial device(p13,p14);
dudnwjs 6:8dd20294b2aa 7 LocalFileSystem local("local"); // Create the local filesystem
dudnwjs 0:a1f6b1ba8a1e 8 DigitalOut myled(LED1);
dudnwjs 6:8dd20294b2aa 9 DigitalOut myled2(LED2);
dudnwjs 6:8dd20294b2aa 10 DigitalOut myled3(LED3);
dudnwjs 6:8dd20294b2aa 11 DigitalOut myled4(LED4);
dudnwjs 0:a1f6b1ba8a1e 12
dudnwjs 1:5cf3a6c969be 13 using namespace sevencore_fota;
dudnwjs 1:5cf3a6c969be 14
dudnwjs 7:3478c46cceef 15 void led_setting_one(void){
dudnwjs 6:8dd20294b2aa 16 myled = 1;
dudnwjs 6:8dd20294b2aa 17 myled2 = 1;
dudnwjs 6:8dd20294b2aa 18 myled3 = 1;
dudnwjs 6:8dd20294b2aa 19 myled4 = 1;
dudnwjs 6:8dd20294b2aa 20 }
dudnwjs 6:8dd20294b2aa 21
dudnwjs 7:3478c46cceef 22 void led_setting_zero(void){
dudnwjs 6:8dd20294b2aa 23 myled = 0;
dudnwjs 6:8dd20294b2aa 24 myled2 = 0;
dudnwjs 6:8dd20294b2aa 25 myled3 = 0;
dudnwjs 6:8dd20294b2aa 26 myled4 = 0;
dudnwjs 6:8dd20294b2aa 27 }
dudnwjs 6:8dd20294b2aa 28
dudnwjs 6:8dd20294b2aa 29 int main() {
dudnwjs 7:3478c46cceef 30 led_setting_zero();
dudnwjs 6:8dd20294b2aa 31
dudnwjs 5:e11b23f9aacc 32 hostpc.baud(9600);
dudnwjs 3:1e70387e1337 33 device.baud(115200);
dudnwjs 6:8dd20294b2aa 34 device.set_flow_control(device.RTSCTS,P2_7,p12);
dudnwjs 3:1e70387e1337 35
dudnwjs 5:e11b23f9aacc 36 BleMsgHandler myfota(&device,&hostpc);
dudnwjs 6:8dd20294b2aa 37
dudnwjs 1:5cf3a6c969be 38 myfota.PrintTitle();
dudnwjs 3:1e70387e1337 39 app_rst_gap(&myfota);
dudnwjs 3:1e70387e1337 40
dudnwjs 5:e11b23f9aacc 41 for(int i = 0; i < 20; i++) {
dudnwjs 4:60be78a172c2 42 myfota.BleReceiveMsg();
dudnwjs 4:60be78a172c2 43 myfota.BleMsgHandle();
dudnwjs 4:60be78a172c2 44 }
dudnwjs 3:1e70387e1337 45
dudnwjs 0:a1f6b1ba8a1e 46 while(1) {
dudnwjs 0:a1f6b1ba8a1e 47 myled = 1;
dudnwjs 0:a1f6b1ba8a1e 48 wait(0.5);
dudnwjs 0:a1f6b1ba8a1e 49 myled = 0;
dudnwjs 0:a1f6b1ba8a1e 50 wait(0.5);
dudnwjs 0:a1f6b1ba8a1e 51 }
dudnwjs 5:e11b23f9aacc 52
dudnwjs 0:a1f6b1ba8a1e 53 }