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: mbed
test.cpp
- Committer:
- sunninety1
- Date:
- 2018-12-04
- Revision:
- 0:25538f02f59a
- Child:
- 1:f8ed70330216
File content as of revision 0:25538f02f59a:
#include "mbed.h"
Serial serial(D8, D2);
InterruptIn userButton(USER_BUTTON);
void sendSerial(void) {
if(serial.writeable()) {
serial.printf("%.2f ",123.5);
wait_ms(500); // lag to debounce the button
}
}
int main(void) {
userButton.fall(callback(sendSerial));
while(1) {}
}
/*
#include "mbed.h"
Serial pc(USBTX, USBRX);
Serial serial(PA_9,PA_10);
char data[10];
int main() {
while(1) {
if(serial.readable() ) {
serial.scanf("%9s", data);
pc.printf("Serial data: %s\r\n", data);
}
}
}*/