Show Posts
Pages: [1]
1  Forum 2005-2010 (read only) / Development / using timer.h on: July 03, 2006, 05:42:29 pm
Hallo....
can anybody help me ??
i'd try to control a servo via PWM with 16 Bit TIMER1, but it's not possible to use any functions from the timer.c  / timer.h

my code :
-----------------------------------------------------------

#include "timer.h"

#define PWM1A   9
#define PWM1B  10
#define DEBUG  

// Program variables
int serv1,serv2;


void setup()
{
        serv1=31;
      serv2=93;
      pinMode(PWM1A,   OUTPUT);   // sets the pins as output
      pinMode(PWM1B,   OUTPUT);  

// how to use these functions from timer.c ???????
      timer1PWMInit(10);
      timer1SetPrescaler(TIMER_CLK_DIV256);

}

// Main program
void loop()
{
  
analogWrite(PWM1A,serv1 );  
  analogWrite(PWM1B,serv2 );

  
}
------------------------------------------------------------
Pages: [1]