Page 290 - 2
P. 290

g_current--;
            }
            }


            void stopMortor(void)
            {
            g_direction = DIR_STOP;
            }


            void *ctrl_thread(void *arg)
            {
            while (1)
            {
            int direction = g_direction;


            if (direction == DIR_STOP)
            {
            sleep(1);
            continue
            }


            if (direction == DIR_FORWARD && g_current>MAX)
            {
            g_current = MAX;
            stopMortor();
            continue
            }


            if (direction == DIR_BACKWARD && g_current<MIN)
            {
            g_current = MIN;
            stopMortor();
            continue
            }


            rotateOneStep(direction);
            }
            }
            //  온습도센서관련
            void read_dht11_dat()
            {
            uint8_t laststate = HIGH;
            uint8_t counter = 0;
            uint8_t j = 0, i;
            float   f;


                                                         - 290 -
   285   286   287   288   289   290   291   292   293   294   295