gjyrjyykkudt

Dependencies:   mbed MCP23017

Revision:
2:32d2cd7d744b
Parent:
1:5b0303768126
Child:
3:8790e69f8c59
--- a/main.cpp	Tue Jan 21 11:10:33 2020 +0000
+++ b/main.cpp	Thu Jan 23 09:16:38 2020 +0000
@@ -7,27 +7,44 @@
 #define SCL PB_6
 #define MCP_ADDRESS 0x40
 
+using namespace MOTOR
+
 MCP MCP(SDA, SCL, MCP_ADDRESS);
 
 Serial pc(USBTX, USBRX);
 
 XBEE::ControllerData *controller;
+MOTOR::MotorStatus motor[MOUNTING_MOTOR_NUM];
 
 int main() {
     
-    for(int i = 0; i < 16; i++) {
-        MCP.PinMode(i, INPUT_PULLUP);
-    }
+    __enable_irq();
+    
+    MOTOR::Motor::Initialize();
+    
+    MCP.PinMode(7, INPUT_PULLUP);
+    MCP.PinMode(6, OUTPUT);
+    
     
     while(1) {
         controller = XBEE::Controller::GetData();
+        
         MCP.Update();
         
+        int a;
+        
         /* write ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ */
-        //for(int i = 0; i < 16; i++) {
-            int a = MCP.Read(7);
+        for(int i = 0; i < 16; i++) {
+            a = MCP.Read(i);
             pc.printf("%d",a);
-        //}
+        }
         pc.printf("\n\r");
+        
+        int b = MCP.Read(7);
+        
+        MCP.Write(6, b);
+        
+        //
+        MOTOR::Motor::Update(motor);
     }
 }