아두이노22 7-Segment void printDigit(int input); byte Pins[] = {9, 8, 3, 4, 5, 7, 6, 2}; byte Digit[] = { 0xFC, // 0 0x60, // 1 0xDA, // 2 0xF2, // 3 0x66, // 4 0xB6, // 5 0xBE, // 6 0xE4, // 7 0xFE, // 8 0xF6, // 9 }; byte read = 0, tmp; void (*func)(byte); void setup(){ Serial.begin(9600); for(int i=0; i 0){ tmp = read; read = Serial.read(); switch(read){ case 'a': case 'A': func = mode1; mode1(true); read = 0; br.. 아두이노 2022. 1. 18. RTC(Real Time Clock) - DS3231 #include #define SCK_PIN 4 #define IO_PIN 3 #define RST_PIN 2 DS1302 rtc(RST_PIN, IO_PIN, SCK_PIN); void setup() { rtc.halt(false); rtc.writeProtect(false); Serial.begin(9600); /* rtc.setDOW(THURSDAY); rtc.setTime(8, 43, 0); rtc.setDate(2, 9, 2021); /**/ } void loop() { Serial.print("It is "); Serial.print(rtc.getDOWStr()); Serial.print(" / "); Serial.print(rtc.getDateStr()); Serial.print(" / ").. 아두이노 2022. 1. 18. 스텝모터(28BYJ-48) 아두이노 2022. 1. 18. 인체감지센서 아두이노 2022. 1. 18. 키패드 #include #define ROWS 4 #define COLS 4 //const char kp4x4Keys[ROWS][COLS] = {{'F', 'B', '8', '4'}, {'E', 'A', '7', '3'}, {'D', '0', '6', '2'}, {'C', '9', '5', '1'}}; const char kp4x4Keys[ROWS][COLS] = {{'1', '2', '3', '4'}, {'5', '6', '7', '8'}, {'9', '0', 'A', 'B'}, {'C', 'D', 'E', 'F'}}; byte rowKp4x4Pin [4] = {9, 8, 7, 6}; byte colKp4x4Pin [4] = {5, 4, 3, 2}; Keypad kp4x4 = Keypad(makeKeymap(.. 아두이노 2022. 1. 18. 초음파센서 // --------------------------------------------------------------------------- // Example NewPing library sketch that does a ping about 20 times per second. // --------------------------------------------------------------------------- #include #define TRIGGER_PIN 12 // Arduino pin tied to trigger pin on the ultrasonic sensor. #define ECHO_PIN 11 // Arduino pin tied to echo pin on the ultrasonic.. 아두이노 2022. 1. 18. 포토럽트 아두이노 2022. 1. 18. 고감도 마이크(KY-036) 아두이노 2022. 1. 18. 릴레이 아두이노 2022. 1. 18. 진동센서 int analogpin = 0; // define analog OUT signal pin int analog; // define variable to store value read from pin int digitalpin = 2; // define digital OUT signal pin int digital; // define variable to store value read from pin void setup() { pinMode(analogpin, INPUT); // set the OUT signal pin as an input pinMode(digitalpin, INPUT); // set the OUT signal pin as an input Serial.begin(9600); // laun.. 아두이노 2022. 1. 18. 적외선 센서 // --------------------------------------------------------------------------- // Example NewPing library sketch that does a ping about 20 times per second. // --------------------------------------------------------------------------- #include #define TRIGGER_PIN 12 // Arduino pin tied to trigger pin on the ultrasonic sensor. #define ECHO_PIN 11 // Arduino pin tied to echo pin on the ultrasonic.. 아두이노 2022. 1. 17. 레이저 #define PIN_OUT 7 void setup() { pinMode(PIN_OUT, OUTPUT); } void loop() { digitalWrite(PIN_OUT, HIGH); delay(1000); digitalWrite(PIN_OUT, LOW); delay(1000); } 아두이노 2022. 1. 17. 이전 1 2 다음