A mbed RTOS based multimeter application that sends results to a phone over the Bluetooth module.
Dependencies: LCD_DISCO_F429ZI mbed mbed-rtos BSP_DISCO_F429ZI
Diff: main.cpp
- Revision:
- 16:c90044414a96
- Parent:
- 15:9c5fb6600570
- Child:
- 17:09bea038e7c0
diff -r 9c5fb6600570 -r c90044414a96 main.cpp --- a/main.cpp Sun Jan 17 22:37:48 2021 +0000 +++ b/main.cpp Sun Jan 17 23:10:24 2021 +0000 @@ -36,7 +36,7 @@ while(1) { led1 = !led1; //ain.set_reference_voltage(3.0); - printf("%s has received the data, now sending it via Queue...\n\r", (const char *)name); + bluetooth.printf("\n%s has received the data from ADC, now sending it via Queue...\n\r", (const char *)name); message_t *message = mpool.alloc(); message->voltage = ain.read()*3; @@ -73,21 +73,23 @@ //float i=0; led2 = !led2; one_slot.wait(); - printf("%s has acquired the semaphore & received the data\n\r", (const char *)name); - printf("Results are displayed by %s\n\r", (const char *)name); + bluetooth.printf("\n---------------------------------------------------------------------\n"); + bluetooth.printf("%s has acquired the semaphore & received the data.\n\r", (const char *)name); + bluetooth.printf("\nResults are now displayed by %s\n\r", (const char *)name); Thread::wait(1000); osEvent evt = queue.get(); if (evt.status == osEventMessage) { message_t *message = (message_t*)evt.value.p; - printf("\nVoltage: %.2f V\n\r" , message->voltage); - printf("Current: %.2f A\n\r" , message->current); + bluetooth.printf("\nVoltage: %.2f V\n\r" , message->voltage); + bluetooth.printf("Current: %.2f A\n\r" , message->current); mpool.free(message);} one_slot.release(); - printf("%s releases semaphore\r", (const char *)name); - printf("\n-----------------------\n"); + bluetooth.printf("\n%s releases semaphore\r", (const char *)name); Thread::wait(1000); + //bluetooth.printf("\n-----------------------\n"); + // bluetooth.printf("Hello World !\r\n"); //bluetooth.printf("This program runs since %f seconds.\r\n", i++);