Page 140 - C Programming
P. 140

ตัวอย่างที่ 10-5 โปรแกรมควบคุมทิศทางการหมุนซ้ายขวาของดีซีมอเตอร์




                #include<stdio.h>


                main()



                  {       char chk;


                          do{ chk=getch();


                                 if(chk = ='r'||chk = ='R')


                                     { gotoxy(8,4);    printf("Turn right Motor ");


                                        outport(0x378,01);   }


                                else if(chk= ='l'||chk = ='L')


                                      { gotoxy(8,4);   printf("Turn left  Motor ");


                                         outport(0x378,02);   }


                                 else{  gotoxy(8,4); printf("  Turn off Motor   ");


                                           outport(0x378,00);   }


                                }while(chk !=27);


                     }
   135   136   137   138   139   140   141   142   143   144   145