BLE-WiFi with BIOSensors
Dependencies: AS7000 BNO055 NNN50_WIFI_API
DELTA NNN50 (Bluetooth LE 4.X & 802.11 b/g/n) with Bio Sensor (HRM, 9DoF motion Sensor) reference design.
Env. Setup step by step.
- Download or build a TCP Server on you host computer
- Please find out the TCP server code or install TCP server application in your host computer.
- Import this sample application and setup these information about AP & TCP Server
- *char* AP_SSID = "SOG";
- *char* AP_PWD = "1122334455667788";
- *char* TCP_SERVER_ADDRESS = "10.0.1.13";
- *int TCP_SERVER_PORT = 1030;
- Compiler your code and download to your mBed device.
- Control your mBed device
- Please use NORDSemi nRF Tool and setup and watch these information: GATT CMD: 0x00 (connect to AP, TCP Server, and create TCP socket), 0x02 disconnection TCP server, close socket, and WiFi sleep), 0xA1 (send sensor data to tcp server from out_buffer[]) and Status will be update by Bluetooth LE adv through manufacturing information
0x00 | 0x02 | 0xA1 |
---|---|---|
WiFi,AP&TCP Server connect | WiFi,AP, & TCP Server disconnect | Send sensor data to TCP Server |
Diff: main.cpp
- Revision:
- 15:d22f450bb909
- Parent:
- 14:eacafd9e019f
--- a/main.cpp Thu Jun 01 07:43:55 2017 +0000 +++ b/main.cpp Thu Jun 01 08:15:15 2017 +0000 @@ -135,10 +135,10 @@ while (true) { wait_ms(2); - __disable_irq(); // Disable Interrupts + //__disable_irq(); // Disable Interrupts imu.get_angles(); //query the i2c device hrm.hr_only(); - __ensable_irq();// Enable Interrupts + // __enable_irq();// Enable Interrupts wait_ms(8); if (BLE_RX_CMD != 0xA1) { if (i > 40){ @@ -164,7 +164,7 @@ isConnect = false; BLE_RX_CMD = 0xFF; #if DEBUG_LOG - pc.printf("Unable to connect to (%s) on port (%d)\n", ECHO_SERVER_ADDRESS, ECHO_SERVER_PORT); + pc.printf("Unable to connect to (%s) on port (%d)\n", TCP_SERVER_ADDRESS, TCP_SERVER_PORT); #endif ADV_manuf[4] = 0xCF; BLE_RX_CMD = 0xFF; @@ -172,7 +172,7 @@ isConnect = true; ADV_manuf[4] = 0xF1; #if DEBUG_LOG - pc.printf("Connected to Server at %s\n",ECHO_SERVER_ADDRESS); + pc.printf("Connected to Server at %s\n",TCP_SERVER_ADDRESS); #endif } } @@ -242,7 +242,7 @@ if (isWiFiEnable == true) { if (sock_tcp.connect(TCP_SERVER_ADDRESS, TCP_SERVER_PORT) < 0) { #if DEBUG_LOG - pc.printf("Unable to connect to (%s) on port (%d)\n", ECHO_SERVER_ADDRESS, ECHO_SERVER_PORT); + pc.printf("Unable to connect to (%s) on port (%d)\n", TCP_SERVER_ADDRESS, TCP_SERVER_PORT); #endif sock_tcp.close(); ADV_manuf[4] = 0xCF; @@ -251,7 +251,7 @@ isCloudFiling = false; ADV_manuf[4] = 0xF1; #if DEBUG_LOG - pc.printf("Connected to Server at %s\n",ECHO_SERVER_ADDRESS); + pc.printf("Connected to Server at %s\n",TCP_SERVER_ADDRESS); #endif } }