Pages: [1]   Go Down
Author Topic: using timer.h  (Read 1504 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 );

  
}
------------------------------------------------------------
Logged

Poitiers (France)
Offline Offline
Full Member
***
Karma: 0
Posts: 136
Ca va j'vais le faire !
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

A similar post of mine, http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1152313475.

Help us smiley please...

Logged

Cordialement,
Benoît ROUSSEAU

Pages: [1]   Go Up
Jump to: