a

Fork of I2C_Master by LAXAN01

Revision:
3:996d0d74fb11
Parent:
2:3d64970eeb96
Child:
4:186241a75818
diff -r 3d64970eeb96 -r 996d0d74fb11 main.cpp
--- a/main.cpp	Wed Oct 24 06:03:27 2018 +0000
+++ b/main.cpp	Wed Oct 24 06:09:41 2018 +0000
@@ -6,8 +6,10 @@
 
 Serial serialPort( PTE0, PTE1);
 
+char motobuffer[3];
+
 int Right_ADDR = 0x14<<1;
-int Left_ADDR  = 0x15<<1;   
+int Left_ADDR  = 0x15<<1;
 
 void sw2_release(void)
 {
@@ -20,7 +22,7 @@
     i2c.write(Right_ADDR);
     i2c.write(0);
     i2c.write(0xe2);
-    i2c.write(0);       
+    i2c.write(0);
     i2c.stop();
 }
 void Driving_Left(void)
@@ -28,8 +30,8 @@
     i2c.start();
     i2c.write(Left_ADDR);
     i2c.write(0);
-    i2c.write(0xe2);
-    i2c.write(0);       
+    i2c.write(motobuffer[1]);
+    i2c.write(motobuffer[2]);
     i2c.stop();
 }
 
@@ -39,14 +41,19 @@
     sw2.rise(&sw2_release);
     serialPort.baud(115200);
     serialPort.printf("WPI Serial Port Started\n");
-        
-    i2c.frequency(100000);    
+
+    i2c.frequency(100000);
     wait_ms(100);
-    
+
+    int motorOutPut=2000;
+    motobuffer[0]=0x00;
+    motobuffer[1]= motorOutPut>>8;
+    motobuffer[2]=motorOutPut;
+
     Driving_Right();
     wait_ms(100);
     Driving_Left();
-    
+
     while (true) {
 
     }