Go Down

Topic: using timer.h (Read 1 time) previous topic - next topic

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

 
}
------------------------------------------------------------

Benoît ROUSSEAU

Cordialement,
Benoît ROUSSEAU

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy