Page 748 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 748
i=(angle+90)*20+14000;
OCR1B=i;
}
void RC_Motor3(int angle) //OCR1A=PB5(15Pin), OCR1B=PB6(16Pin), OCR3A=PE3(5Pin),
OCR3B=PE4(6Pin)
{
int i;
if(angle<-90) angle=-90;
if(angle>90) angle=90;
i=(angle+90)*20+14000;
OCR3A=i;
}
void RC_Motor4(int angle) //OCR1A=PB5(15Pin), OCR1B=PB6(16Pin), OCR3A=PE3(5Pin),
OCR3B=PE4(6Pin)
{
int i;
if(angle<-90) angle=-90;
if(angle>90) angle=90;
i=(angle+90)*20+14000;
OCR3B=i;
}
int main()
{
system_init();
OCR1A=OCR1B=OCR3A=OCR3B=0;
RC_Motor1(0);
RC_Motor2(0);
RC_Motor3(0);
RC_Motor4(0);
sei();
while(1);
return 0;
}
//delay 추가시 덧붙여서 쓰기(최대 7초)
ISR(INT0_vect) //서보모터 1번
{
cli();
RC_Motor2(0);
- 741 -