diff options
| author | Rishi-k-s <rishikrishna.sr@gmail.com> | 2024-07-07 20:54:09 +0530 |
|---|---|---|
| committer | Rishi-k-s <rishikrishna.sr@gmail.com> | 2024-07-07 20:54:09 +0530 |
| commit | 87cf0d7810d206fa7d5d7cb43a6c9c12c5edc884 (patch) | |
| tree | fb9d9e4d51df40a514cf6b15d07db38d47b20aea | |
| parent | 3c5d0f10f1386bc64716d9e9e7556f45af948c42 (diff) | |
chanched some files hav to work on bug and v.1.1.1a
| -rw-r--r-- | homeposition/homeposition.ino | 8 | ||||
| -rw-r--r-- | test/test.ino | 38 |
2 files changed, 37 insertions, 9 deletions
diff --git a/homeposition/homeposition.ino b/homeposition/homeposition.ino index ed3964f..d059db5 100644 --- a/homeposition/homeposition.ino +++ b/homeposition/homeposition.ino @@ -5,8 +5,8 @@ Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(); uint16_t value = 0; // Use uint16_t for a wider range of values uint8_t counter = 0; -#define SERVOMIN 150 // This is the 'minimum' pulse length count (out of 4096) -#define SERVOMAX 600 // This is the 'maximum' pulse length count (out of 4096) +// #define SERVOMIN 150 // This is the 'minimum' pulse length count (out of 4096) +// #define SERVOMAX 600 // This is the 'maximum' pulse length count (out of 4096) int homePosCheck =0; int i =0; @@ -15,11 +15,9 @@ void setup() { Serial.println("------------------------"); Serial.println("Servo Home Position v1.0a"); - // Serial.println("Enter Servo Value"); - // Serial.println("If its 2 digit values enter it with 0 as prefix"); - // Serial.println("Eg: for 90, type 090"); Serial.println("------------------------"); + pwm.begin(); pwm.setOscillatorFrequency(27000000); pwm.setPWMFreq(50); diff --git a/test/test.ino b/test/test.ino index f06f00d..a2bd2e2 100644 --- a/test/test.ino +++ b/test/test.ino @@ -8,6 +8,8 @@ uint8_t counter = 0; #define SERVOMIN 150 // This is the 'minimum' pulse length count (out of 4096) #define SERVOMAX 600 // This is the 'maximum' pulse length count (out of 4096) +bool homePosCheck = false; + void setup() { Serial.begin(9600); @@ -61,10 +63,38 @@ void loop() { counter = 0; value = 0; // Reset value after using it } + + if (homePosCheck ==0){ + homePos(); + homePosCheck =0; + } + + + } -// void homePos(){ -// (PWM Driver Pin, 0, val of servo) -// pwm.setPWM(0, 0, value); -// } +void homePos() { + // (PWM Driver Pin, 0, val of servo) + //motor1 + for(int i=500;i>=395;i--){ + pwm.setPWM(0, 0, i); + delay(5); + } + delay(100); + //motor2 + pwm.setPWM(1, 0, 110); + delay(100); + //motor3 + pwm.setPWM(2, 0, 250); + delay(100); + //motor4 + pwm.setPWM(3, 0, 380); + delay(100); + //motor5 + pwm.setPWM(4, 0, 430); + delay(100); + //motor6 + pwm.setPWM(5, 0, 490); + +} |
