강의노트11 키패드 #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. 적외선 센서 // --------------------------------------------------------------------------- // 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. 3색 LED #define PIN_RED11 #define PIN_GREEN10 #define PIN_BLUE9 void mode1(); void mode2(); void mode3(); void setMode(char); byte R = 255, G = 0, B = 0, k = 0, mod = 0; void (*func)(); void setup() { Serial.begin(9600); pinMode(PIN_RED, OUTPUT); pinMode(PIN_GREEN, OUTPUT); pinMode(PIN_BLUE, OUTPUT); func = mode2; } void loop() { func(); if (Serial.available() > 0) { delay(3); char c = Serial.read(); se.. 아두이노 2022. 1. 17. 8 x 8 dot Matrix 코드 1 : 문자열을 출력하는 코드 #include "LedControlMS.h" #define DATA_IN 4 #define CLK3 #defineCS2 #define NBR_MTX 1 //number of matrices LedControl lc=LedControl(DATA_IN, CLK, CS, NBR_MTX); String str="Serial Input is Ready!"; String inputStr; void setup() { Serial.begin(9600); for (int i=0; i< NBR_MTX; i++) { lc.shutdown(i,false); /* Set the brightness to a medium values */ lc.setIntensity(i,8); /* and c.. 아두이노 2022. 1. 17. 건반 만들기 연결 상태 : 동작 : 키보드를 누르면 소리가 남 코드 : (주의! pitches.h가 해당 폴더에 있어야 함) #include "pitches.h" int melody[] = { NOTE_C4, NOTE_G3, NOTE_G3, NOTE_A3, NOTE_G3, 0, NOTE_B3, NOTE_C4 }; // 4 = 4분음표, 8 = 8분음표: int noteDurations[] = { 4, 8, 8, 4, 4, 4, 4, 4 }; void setup() { Serial.begin(9600); for (int i = 0; i < 8; i++) { int noteDuration = 1000 / noteDurations[i]; tone(8, melody[i], noteDuration); delay(noteDur.. 아두이노 2022. 1. 17. 서보모터 SG90 부품 특성 : 코드 : #include #define PIN_PWM 9 #define MIN 0 #define MAX 180 #define MODE 0 void UpAndDown(); void OrderBySerial(); void setMode(int mode); Servo moter; String readString; String wBuf; int theta=0; int step = 5; void (*func)() = UpAndDown; void setup() { Serial.begin(9600); moter.attach(PIN_PWM, MIN,MAX); moter.writeMicroseconds(20); setMode(0); } void setMode(int mode) { switch(mode) {.. 아두이노 2022. 1. 17. 아날로그 입력 아두이노 2022. 1. 17. 이전 1 다음