193030

Vibrating motors code same as previous

Sep 22nd, 2020
751
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int actuators = 6; // 3
  6. int stepsCount = 10; // Tova ne ni trqbva tuk
  7. int stepsDuration = 100;
  8. // int arrayFromGoogleSheets[20] = {0,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0};
  9. //int arrayFromGoogleSheets[30] = {1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1};
  10. int arrayFromGoogleSheets[60] = {1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  11. 0,0,0,0,0,0,0,0,0,0,0};
  12. // 6250200008111111110000000000000000000000000000000000000000000000000000
  13. int actuatorArrayStep[40];
  14.  
  15. int currentStep = 0;
  16. int actuatorState;
  17.  
  18. void SetArray()
  19. {
  20.     for(int i =0; i<actuators;i++)
  21.     {
  22.      actuatorArrayStep[i] = stepsCount*i; // 1
  23.     }
  24. }
  25. /* void TurnActuator(int actuator, int state)
  26. {
  27.     //digitalWrite(actuator, state);
  28. }
  29. */
  30. int main()
  31. {
  32.     SetArray();
  33. //  if(stepsDuration >= currentMillis-previousMillis)
  34. //  {
  35.    for(int k = 0; k<stepsCount; k++)
  36.    {
  37.        cout << "LOOP CYCLE: " << k << endl;
  38.         for(int i =0; i<actuators; i++)
  39.         {
  40.             int currentTempState = actuatorArrayStep[i] + currentStep;
  41.             actuatorState = arrayFromGoogleSheets[currentTempState];
  42.         //  TurnActuator(i, actuatorState);
  43.             if(actuatorState == 1)
  44.                 cout << "motor: " << i <<"  true \n";
  45.             else
  46.                 cout << "motor: " << i <<" false \n";
  47.         }
  48.         currentStep++;
  49.    }
  50.   //}
  51.  
  52.     }
  53.  
  54.  
RAW Paste Data