Page 746 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 746

ser.write('a')
                                                       coin=0
                                                       stage=1
                                                       count=0
                                            elif  game_list[random_index]=="paper":
                                                                            screen.blit(text_draw,[200,570])
                                                       count=0
                       pygame.display.flip()
                       time.sleep(.5)
            ser.close()


            다. Atmega128 서보모터  제어 프로그램

            1)  1차  프로그램
            #include  <stdio.h>
            #include  <avr/io.h>
            #include  <util/delay.h>


            void  RC_Motor(int  angle)
            {
            int  i;
            if(angle<-90)  angle=-90;
            if(angle>90)  angle=90;
            i=(angle+90)*20+1500;
            OCR3A=i;
            }


            int  main()
            {
            DDRB=0xff;
            DDRE=0xff;
            TCCR1A=0xaa;
            TCCR1B=0x1a;
            TCCR3A=0xaa;
            TCCR3B=0x1a;
            ICR1=19999;
            ICR3=19999;
            while(1)
            {
            RC_Motor(45),  _delay_ms(500);
            RC_Motor(90),  _delay_ms(500);
            }



                                                         -  739  -
   741   742   743   744   745   746   747   748   749   750   751