This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| et:examples:motors:servo [2009/06/16 20:24] – raivo.sell | et:examples:motors:servo [2009/11/04 13:25] (current) – eemaldatud mikk.leini | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== RC Servo motor ====== | ||
| - | ===== Ühendamine ===== | ||
| - | {{: | ||
| - | |||
| - | {{: | ||
| - | {{: | ||
| - | |||
| - | |||
| - | ===== RC servomootori juhtsignaal ===== | ||
| - | |||
| - | {{: | ||
| - | |||
| - | ===== Näitekood ===== | ||
| - | |||
| - | <code c> | ||
| - | / | ||
| - | Title: RC Servo motor with Actuator Board | ||
| - | Date: | ||
| - | Ver.: 1.1 | ||
| - | Compiler: | ||
| - | Target: | ||
| - | Hardware: | ||
| - | Author: Raivo Sell 2008 | ||
| - | |||
| - | Notes: | ||
| - | Description: | ||
| - | ---------------------------------------------------------------*/ | ||
| - | #define F_CPU 14745600UL //CPU Frequency (influences delay function) | ||
| - | |||
| - | #include < | ||
| - | #include < | ||
| - | |||
| - | ///////////////// | ||
| - | int main (void){ | ||
| - | |||
| - | // Set timer control registers | ||
| - | TCCR1A = _BV(COM1A1) | _BV(COM1B1) | _BV(WGM11); | ||
| - | TCCR1B = _BV(CS11) | _BV(WGM13) | _BV(WGM12); | ||
| - | | ||
| - | DDRB = 0x30; // PB5 & PB6 output | ||
| - | ICR1 = 36000; // Sets the upper limit to Timer1 | ||
| - | // | ||
| - | OCR1A | ||
| - | |||
| - | while(1){ | ||
| - | for(OCR1A=500; | ||
| - | for(OCR1A=5000; | ||
| - | } | ||
| - | } | ||
| - | </ | ||