robot arm with servos

Dependencies:   mbed INA219

Revision:
1:3125b4958359
Parent:
0:4d49538f919b
--- a/main.cpp	Wed Sep 09 06:16:50 2020 +0000
+++ b/main.cpp	Sun Jul 04 16:09:41 2021 +0000
@@ -1,15 +1,21 @@
  
 #include "mbed.h"
+#include    "INA219.h"
+//int p_sda = PB_7;
+//int p_scl = PB_6;
+//INA219::INA219 (p_sda, p_scl, const INA219_TypeDef *ina219_parameter)
+ //: _i2c_p(new I2C(p_sda, p_scl)), _i2c(*_i2c_p)
  
 using namespace std::chrono;
  
- 
 //#define ROBO_DEBUG
  
  
 #define MAX_NR_OF_SERVOS 9
 #define MSG_TERMINATOR '\n'
  
+ 
+PwmOut S_1(PA_12); PwmOut S_2(PB_0); PwmOut S_3(PB_4); PwmOut S_4(PB_5); PwmOut S_5(PA_8); PwmOut S_6(PA_11);
 // Create a BufferedSerial object to be used by the system I/O retarget code.
 static BufferedSerial serial_port(PA_2, PA_15, 115200);
  
@@ -106,14 +112,14 @@
  
   // pin | min | max | reset | speed
   // connected 5 servos (5-9)
-  Kernel::Clock::duration_u32 speed=10ms;
-  servoVec[actualNrOfServos++] = new cCustomServo(A2, 0, 180, 90, speed); // umar
-  servoVec[actualNrOfServos++] = new cCustomServo(D3, 0, 180, 90, speed); // cot1
-  servoVec[actualNrOfServos++] = new cCustomServo(D4, 0, 180, 90, speed); // cot2
-  // servoVec[actualNrOfServos++] = new cCustomServo(D7, 15, 165, 90, speed); // cot3 !!!deconectat!!!
-  servoVec[actualNrOfServos++] = new cCustomServo(D5, 0, 180, 90, speed); // rotatie cleste
-  servoVec[actualNrOfServos++] = new cCustomServo(D6, 0, 65, 21, speed); // deschidere cleste
- 
+  Kernel::Clock::duration_u32 speed=8ms;
+  servoVec[actualNrOfServos++] = new cCustomServo(D10, 0, 180, 90, speed); // servo baza A
+  //servoVec[actualNrOfServos++] = new cCustomServo(PB_0, 0, 180, 90, speed); // servo cot C 
+  servoVec[actualNrOfServos++] = new cCustomServo(D2, 0, 180, 90, speed); // servo rotatie cleste D 
+  servoVec[actualNrOfServos++] = new cCustomServo(D9, 0, 180, 90, speed); // nu raspunde
+  servoVec[actualNrOfServos++] = new cCustomServo(D11, 0, 180, 90, speed); //  Servo cot nu raspunde
+  servoVec[actualNrOfServos++] = new cCustomServo(D12, 0, 180, 90, speed); // servo nu raspunde
+//PwmOut S_1(PA_12); PwmOut S_2(PB_0); PwmOut S_3(PB_4); PwmOut S_4(PB_5); PwmOut S_5(PA_8); PwmOut S_6(PA_11); 
   for (int i = 0; i < actualNrOfServos; i++) {
     servoVec[i]->reset();
     newAngles[i] = servoVec[i]->getCurrentAngle();