| Electronic Components Datasheet Search |
|
DEV-13042 Datasheet(PDF) 7 Page - SparkFun Electronics |
|
|
|||||||||||||||||||||||||||||
DEV-13042 Datasheet(HTML) 7 Page - SparkFun Electronics |
|
7 / 9 page ![]() { // Check and print the start and stop times for the RED ch annel, then set // all three to one percentage point higher. You'll note that the start // time is always 0, and that the stop times increase log arithmically. This // lets us get a visually linear brightness out of the LE Ds. pwm.getChlTime(RED, &startTime, &stopTime); cout<<"Start time: "<<dec<<startTime<<endl; cout<<"Stop time: "<<dec<<stopTime<<endl; pwm.setChlLEDPercent(BLUE, i); pwm.setChlLEDPercent(GREEN, i); pwm.setChlLEDPercent(RED, i); usleep(100000); } sleep(4); pwm.setChlTime(RED, 0, 0); pwm.setChlTime(GREEN, 0, 0); pwm.setChlTime(BLUE, 0, 0); cout<<"LED demo complete!"<<endl; #endif #ifdef SERVO_DEMO // We can set or get the minimum and maximum angles the angl e set function // expects to see. int16_t servoMinAngle, servoMaxAngle; pwm.getServoAngleLimits(&servoMinAngle, &servoMaxAngle); cout<<"Current servo min angle: "<<dec<<servoMinAngle<<endl; cout<<"Current servo max angle: "<<dec<<servoMaxAngle<<endl; // Likewise, we can set the min and max of pulse widths. Eac h count here is // about 4.5us, depending on the clock's accuracy. uint16_t minServoPL, maxServoPL; pwm.getServoAnglePulseLimits(&minServoPL, &maxServoPL); cout<<"Current servo min pulse length: "<<dec<<minServoPL<<e ndl; cout<<"Current servo max pulse length: "<<dec<<maxServoPL<<e ndl; // These numbers are based on experimentation with SparkFu n's generic // submicro servo motor. You may find that they are too hi gh or too low for // your particular motor. The generic settings are fairly c onservative and // there is no need to use these functions unless you feel like you can get // a wider range of motion by doing so. servoMinAngle = 0; servoMaxAngle = 160; minServoPL = 108; maxServoPL = 450; pwm.setServoAnglePulseLimits(minServoPL, maxServoPL); pwm.setServoAngleLimits(servoMinAngle, servoMaxAngle); // enabling servo mode makes the output active high and set s the frequency to // approximately 50Hz. pwm.enableServoMode(); // For comparison against default values or LED mode values. Page 7 of 9 |
|
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |