33 lines
481 B
C
Executable file
33 lines
481 B
C
Executable file
/*
|
|
* controletptestxddd.c
|
|
*
|
|
* Created: 04/04/2021 15:10:52
|
|
* Author : Alzyohan
|
|
*/
|
|
|
|
#include <avr/io.h>
|
|
#define SIGNAL_1500 153
|
|
#define SIGNAL_3000 76
|
|
void timer0_init();
|
|
|
|
int main(void)
|
|
{
|
|
DDRB|=(1<<PB3);
|
|
DDRC=0x00;
|
|
while(1){
|
|
if((PINC & (1<<PC0))==0)
|
|
{
|
|
timer0_init(SIGNAL_1500);
|
|
}
|
|
if((PINC & (1<<PC1))==0)
|
|
{
|
|
timer0_init(SIGNAL_3000);
|
|
}
|
|
}
|
|
}
|
|
|
|
void timer0_init(unsigned int x)
|
|
{
|
|
OCR0=x;
|
|
TCCR0|=(1<<CS01)|(1<<WGM01)|(1<<COM00);
|
|
}
|