In the process of converging these two codes I will make notes on what comments have been added to which lines. Note it's unlikely the lines will say the same but the general area or functions well in laissez later remark specifies.
15-apr-2016
Ok the optical encoder has been hooked up. Now its time to play with it and see what it can do. With 100 steps It is having a hard time reading. The rpm is almost non exsistent.
I may be able to use a command interrupt https://www.arduino.cc/en/Reference/AttachInterrupt
meanwhile i'm going to try a digital pin 13 instead of analog pin 8. Yes that worked and I thank it is faster also. So now using the digital read and later the interrupt will help.
Side note when I start using the udoo's gpio pins I should be able to read the most processor intensive processes using the cpu and free up some gpu processor speed.
I added the interrupt, still have some progress to make but this helped a lot. http://www.allaboutcircuits.com/technical-articles/using-interrupts-on-arduino/
12-Apr-2016
Putting the code aside for while I'm going to focus on an optical encoder to improvise for inconsistencies on my servo motor(which does not have a built-in coder). To see the details from the optical encoder use the link ( Here)
Date unknown
- Line 8 #include <Servo.h> --Remove from line 8; already in previous code online 79 under loop
- Line 41 String serial;// Used in AirRegulatorServo()
- line 42 add Servo myservo;// Used in the air systam sorvo. see about oving this.------------------
- Line 49 myservo.attach(9);// Used in AirRegulatorServo() Set Pin, Defalt: 9. ------------------------See about moving this into the function AirRegulatorServo(). At a later time
- Line 134 Add reference to AirRegulatorServo(serial); under loop------------------------------------- see about adding a condition to running this function.
- Line 582 Add function
void AirRegulatorServo(String serial){
}
else serial = "90";
if(serial.toInt()<90){
myservo.write(serial.toInt()-4);
}
else myservo.write(serial.toInt());
delay(500);// Temp remove after tested.
}
This will be modified at a later time.
This function is still in progress and will be updated regularly here on my online notebook.
Momentarily problem the servo is spending without apparent merit.
Partial solution by default serial is zero and not what's required for stationary which is 90.
Momentarily problem the servo is spending without apparent merit.
Partial solution by default serial is zero and not what's required for stationary which is 90.
- Line 115under loop change serial = "0" to serial = "90".
- line 589 remove -4 that can be corrected my calibrating the sovor.
- Line134 in loop i move it to line 135 this is what I have added
if (serial.substring(0, dotLocation) == "servo") {
servoVal = serial.substring(dotLocation + 1);
AirRegulatorServo(servoVal);
}
- remove delay on line 597
No comments:
Post a Comment