Quadcopter control software

Dependencies:   Pulse USBDevice mbed

Files at this revision

API Documentation at this revision

Comitter:
DanO21050
Date:
Wed Jun 15 16:19:33 2016 +0000
Parent:
0:28d8de532ed1
Commit message:
1 motor working, serial to pc working, I2C not working

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 28d8de532ed1 -r 447dfa0477e9 main.cpp
--- a/main.cpp	Tue Jun 14 19:39:40 2016 +0000
+++ b/main.cpp	Wed Jun 15 16:19:33 2016 +0000
@@ -3,14 +3,22 @@
 #include "USBSerial.h"
 //#include "Servo.h"
 
-#define Motor1_Pin                       PTA12      //D3 PWM port
+#define Motor1_Pin                      PTA12      //D3 PWM port
+#define AnalogIn_Pin                    PTD1       //A0 Port
 
-#define AnalogIn_Pin                     PTD1       //A0 Port
+#define I2C_SDA_Pin                     PTB3
+#define I2C_SCL_Pin                     PTB2
+#define accelerometerAddress            0x6B
+
+
+
 DigitalOut      Motor1(Motor1_Pin);
 AnalogIn        MotorPowerLevel(AnalogIn_Pin);
 
-//Virtual serial port over USB
-USBSerial serial;
+
+USBSerial serial; //Virtual serial port over USB
+
+I2C i2c(I2C_SDA_Pin,I2C_SCL_Pin);
 
 Ticker ticker1;
 
@@ -59,6 +67,7 @@
     while(1){
         currentPowerLevel = MotorPowerLevel.read();
         
+        i2c.read
         serial.printf("I am a virtual serial port\r\n");
         wait(1);
         //PWM_Motor1.pulsewidth(((1.0+currentPowerLevel)/1000.0));