Page 294 - 2
P. 294

else g_direction = DIR_STOP;


            if (digitalRead(LIGHTSEN_OUT) == 0){
            act_led_off();
            printf("DAY \n");
            }
            if (digitalRead(LIGHTSEN_OUT) == 1){
            act_led_on();
            printf("NIGHT \n");
            }
            printf("(i) DIRECTION:%d\n", g_direction);
            delay(30000);//  센서읽는시간 초0
            '7d
            else if (sw == 1){
            if (digitalRead(STEPR) == 1) g_direction = DIR_FORWARD;
            else g_direction = DIR_BACKWARD;
            }
            }
            return(0);
            }


              나 아두이노 코드.
            #include <SPI.h>
            #include <MFRC522.h>
            #include <Servo.h>


            #define SS_PIN 10
            #define RST_PIN 9
            int servoPin = 8;
            int count = 0;


            Servo servo;


            int angle = 0;


            MFRC522 rc522(SS_PIN, RST_PIN);                      // Create MFRC522 instance


            void setup() {
              Serial.begin(9600);
              SPI.begin();
              rc522.PCD_Init();                             // Init MFRC522 card
              Serial.println("Scan card...\r\n");
              pinMode(servoPin, INPUT);
              servo.attach(servoPin);


                                                         - 294 -
   289   290   291   292   293   294   295   296   297   298   299