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.
Dependents: R1Arobo_Maika_B 2021Arobo_UMAPYOI 2021Arobo_YUMIPYOI
Diff: Serial6050.h
- Revision:
- 0:c3d09c97649b
- Child:
- 1:97a3a91ce950
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Serial6050.h Thu Sep 20 01:13:45 2018 +0000
@@ -0,0 +1,32 @@
+#pragma once
+#include "mbed.h"
+
+#define ERROR -10000
+
+enum axis {
+ YAW,
+ PITCH,
+ ROLL
+};
+
+class Serial6050
+{
+private:
+ RawSerial serial;
+ DigitalOut rst;
+ int resetValue;
+ void intReceive() {
+ char data = serial.getc();
+ if(data >= 0x80)
+ higher = data & 0x7f;
+ else
+ lower = data & 0x7f;
+ }
+public:
+ Serial6050(PinName tx, PinName rx, PinName reset);
+ void init();
+ void reset();
+ volatile char lower;
+ volatile char higher;
+ float read();
+};
\ No newline at end of file