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.
Diff: main.cpp
- Revision:
- 0:1b9c87e81f07
- Child:
- 1:2b7034eb3015
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Mon Feb 04 12:58:20 2019 +0000
@@ -0,0 +1,43 @@
+#include "mbed.h"
+
+/*------------------------------------------------------------------------------
+Before to use this example, ensure that you an hyperterminal installed on your
+computer. More info here: https://developer.mbed.org/handbook/Terminals
+
+The default serial comm port uses the SERIAL_TX and SERIAL_RX pins (see their
+definition in the PinNames.h file).
+
+The default serial configuration in this case is 9600 bauds, 8-bit data, no parity
+
+If you want to change the baudrate for example, you have to redeclare the
+serial object in your code:
+
+Serial pc(SERIAL_TX, SERIAL_RX);
+
+Then, you can modify the baudrate and print like this:
+
+pc.baud(115200);
+pc.printf("Hello World !\n");
+------------------------------------------------------------------------------*/
+
+DigitalOut led(LED1);
+
+Serial pc(SERIAL_TX, SERIAL_RX);
+Serial xbee(PA_9, PA_10);
+
+int main()
+{
+ pc.baud(57600);
+xbee.baud(57600);
+ int i = 1;
+
+ pc.printf("Hello World pc!\r\n");
+ xbee.printf("Hello World Xbee!\r\n");
+
+ while(1) {
+ wait(1); // 1 second
+ led = !led; // Toggle LED
+ pc.printf("PC - This program runs since %d seconds.\r\n", i++);
+ xbee.printf("Xbee - This program runs since %d seconds.\r\n", i++);
+ }
+}