imu for l432kc

Dependencies:   mbed

Committer:
sunninety1
Date:
Tue Dec 04 04:23:40 2018 +0000
Revision:
0:25538f02f59a
Child:
1:f8ed70330216
Bluetoothhhh

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sunninety1 0:25538f02f59a 1
sunninety1 0:25538f02f59a 2
sunninety1 0:25538f02f59a 3 #include "mbed.h"
sunninety1 0:25538f02f59a 4
sunninety1 0:25538f02f59a 5 Serial serial(D8, D2);
sunninety1 0:25538f02f59a 6 InterruptIn userButton(USER_BUTTON);
sunninety1 0:25538f02f59a 7
sunninety1 0:25538f02f59a 8 void sendSerial(void) {
sunninety1 0:25538f02f59a 9 if(serial.writeable()) {
sunninety1 0:25538f02f59a 10 serial.printf("%.2f ",123.5);
sunninety1 0:25538f02f59a 11 wait_ms(500); // lag to debounce the button
sunninety1 0:25538f02f59a 12 }
sunninety1 0:25538f02f59a 13 }
sunninety1 0:25538f02f59a 14
sunninety1 0:25538f02f59a 15 int main(void) {
sunninety1 0:25538f02f59a 16 userButton.fall(callback(sendSerial));
sunninety1 0:25538f02f59a 17
sunninety1 0:25538f02f59a 18 while(1) {}
sunninety1 0:25538f02f59a 19 }
sunninety1 0:25538f02f59a 20
sunninety1 0:25538f02f59a 21 /*
sunninety1 0:25538f02f59a 22 #include "mbed.h"
sunninety1 0:25538f02f59a 23
sunninety1 0:25538f02f59a 24 Serial pc(USBTX, USBRX);
sunninety1 0:25538f02f59a 25 Serial serial(PA_9,PA_10);
sunninety1 0:25538f02f59a 26 char data[10];
sunninety1 0:25538f02f59a 27
sunninety1 0:25538f02f59a 28 int main() {
sunninety1 0:25538f02f59a 29 while(1) {
sunninety1 0:25538f02f59a 30 if(serial.readable() ) {
sunninety1 0:25538f02f59a 31 serial.scanf("%9s", data);
sunninety1 0:25538f02f59a 32 pc.printf("Serial data: %s\r\n", data);
sunninety1 0:25538f02f59a 33 }
sunninety1 0:25538f02f59a 34 }
sunninety1 0:25538f02f59a 35 }*/