segway_self balancing robot 4180 project
Dependencies: mbed mbed-rtos LSM9DS1_Library
Revision 13:c00ddcfea79f, committed 2020-04-18
- Comitter:
- pandirimukund
- Date:
- Sat Apr 18 20:49:31 2020 +0000
- Parent:
- 12:980c06d63425
- Child:
- 14:89bb16d03b15
- Commit message:
- made baseline layout for the code;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sat Apr 18 20:45:02 2020 +0000
+++ b/main.cpp Sat Apr 18 20:49:31 2020 +0000
@@ -1,20 +1,29 @@
#include "mbed.h"
#include "rtos.h"
-DigitalOut myled(LED2);
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////// Variable Initialization//////////////////////////
+///////////////////////////////////////////////////////////////////////////////
Ticker bluetooth;
Serial pc(USBTX, USBRX);
Mutex parametersmutex;
+Serial blue(p28, p27);
-//Control system variables
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////// Control System Variables/////////////////////////
+///////////////////////////////////////////////////////////////////////////////
float rp = 50;
float rd = 51;
float ri = 50;
float desired_angle = 0;
-Serial blue(p28, p27);
+
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////// Bluetooth Section ///////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
void bluetooth_update() {
char bnum = 0;
char bhit = 0;
@@ -95,10 +104,40 @@
}
}
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////// Control System Updates///////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+//make the calls to IMU here and this should be another thread
+void update_system() {
+ return;
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////// IMU STUFF////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+void calibrate_imu() {
+ return;
+}
+
+void get_current_angle() {
+ return;
+}
+
+
+
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////// Running Main Function////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+
int main() {
pc.printf("this is running");
Thread bluetooth;
+ Thread system_update;
bluetooth.start(bluetooth_update);
+ system_update.start(update_system);
//bluetooth.attach(&bluetooth_update, 0.1);
while (1) {
//bluetooth_update();
