IoT/Arduino

    [아두이노] IR리모컨을 이용한 LED RGB변경

    #include // 핀 선언 int red = 9; int green = 13; int blue = 10; int RECV_PIN = 11; IRrecv irrecv(RECV_PIN); decode_results results; void setup() { pinMode(red,OUTPUT); pinMode(green,OUTPUT); pinMode(blue,OUTPUT); Serial.begin(9600); irrecv.enableIRIn(); // start the receiver } void loop() { if(irrecv.decode(&results)){ Serial.println(results.value, HEX); irrecv.resume(); // receive the next value /..

    [아두이노] LCD 텍스트 출력

    /* LiquidCrystal Library - Hello World Demonstrates the use a 16x2 LCD display. The LiquidCrystal library works with all LCD displays that are compatible with the Hitachi HD44780 driver. There are many of them out there, and you can usually tell them by the 16-pin interface. This sketch prints "Hello World!" to the LCD and shows the time. The circuit: * LCD RS pin to digital pin 12 * LCD Enable ..

    [아두이노] 7세그먼트

    - 아노드 + 연결 - 케소드 - 연결 일반방식으로 켜기 void setup() { pinMode(2, OUTPUT); pinMode(3, OUTPUT); pinMode(4, OUTPUT); } void loop() { digitalWrite(2, HIGH); digitalWrite(3, HIGH); digitalWrite(4, HIGH); delay(10); } 배열선언해서 켜기 byte num[3][7] = { {1,1,1,1,1,1,0}, {0,1,1,0,0,0,0}, {1,1,0,1,1,0,1} }; //3개의 숫자를 표현하기 위해 //각각 숫자마다 7개의 led관리하기 위해 void displayNum(int n){ for(int i=0; i

    [아두이노] 온도센서 사용하기

    void setup() { pinMode(A0, INPUT); Serial.begin(9600); } void loop() { //온도 1도당 10mV전압이 달라짐 그걸 계산하는 수식임 Serial.println(-40 + 0.488155 * (analogRead(A0) - 20)); delay(10); }

    [아두이노] 버튼누를시 LED작동

    //변수 세팅 int r_led = 13; int y_led = 12; int g_led = 11; int button = 3; void setup() { pinMode(r_led, OUTPUT); pinMode(y_led, OUTPUT); pinMode(g_led, OUTPUT); pinMode(button, INPUT); } void loop() { //button이 HIGH일때 등화순서 3(빨간불) if(digitalRead(button) == HIGH){ digitalWrite(y_led, LOW); digitalWrite(r_led, HIGH); } else { //등화순서 2 (노란불) delay(5000); //5초대기 digitalWrite(r_led, LOW); digitalWrite(y..