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: ConfigFile EthernetInterface mbed-rtos mbed
Fork of S05APP3 by
Diff: main.cpp
- Revision:
- 11:205ddd5406af
- Parent:
- 10:488877f7f56c
- Child:
- 12:42986a9c3682
--- a/main.cpp Mon Feb 13 04:17:28 2017 +0000 +++ b/main.cpp Mon Feb 13 04:37:56 2017 +0000 @@ -10,6 +10,7 @@ Serial xbee(p13, p14); // tx, rx Serial pc(USBTX, USBRX); // tx, rx TCPSocketConnection sock; +Ticker ticker1; uint64_t routerAddress; uint16_t portNumber = 0; @@ -73,7 +74,7 @@ boolLED = !boolLED; } -void initSocket(uint16_t data) { +void sendDataToServer(uint16_t data) { /*int responseSize; char buffer[50]; sprintf(buffer, "Data: %i\n", data); @@ -145,10 +146,10 @@ // pc.printf("Acceleration Y: %d\n", acc[1]); // pc.printf("Acceleration Z: %d\n", acc[2]); - initSocket(acc[0]); + sendDataToServer(acc[0]); } else if (buffer[0] == 0x90 && bufferSize == 13) { // Dry contact - // acc[0] = buffer[12]; + // sendDataToServer(buffer[12]); } } @@ -176,6 +177,8 @@ } } +void isr() {} + int main() { pc.printf("Starting a coordinator... \n"); @@ -188,8 +191,8 @@ xbee.baud(9600); // Set baud rate xbee.printf("ATID %i\r",panId); // Set the 64-bit PAN ID - xbee.printf("ATWR \r"); // - xbee.printf("ATCN \r"); + xbee.printf("ATWR \r"); // Save the changes + xbee.printf("ATCN \r"); // Apply changes by sending the CN command if (eth.init() != 0) { // Use DHCP pc.printf("Erreur d'initialisation du RJ45.\n"); @@ -202,7 +205,6 @@ // Démarrage des tâches: Thread _readDataFromRouter(readDataFromRouter); //Thread _toggleRouterLed(toggleLed); - while(1) {} }