목록Hardware/Arduino (3)
STUDY BLOG

시리얼 모니터에 r 입력시 빨간불 on 한번 더 입력 시 off 시리얼 모니터에 g 입력시 초록불 on 한번 더 입력 시 off 시리얼 모니터에 b 입력시 파란불 on 한번 더 입력 시 off unsigned char c; const int pinLEDR=10; const int pinLEDG=11; const int pinLEDB=12; int red=0; int green=0; int blue=0; void setup() { // put your setup code here, to run once: Serial.begin(9600); pinMode(pinLEDR, OUTPUT); pinMode(pinLEDG, OUTPUT); pinMode(pinLEDB, OUTPUT); pinMode(Serial.r..

가만히 있으면 RGB LED 모듈 OFF 틸트센서 기울이면 REB LED 모듈 모든 색상 ON const int pinTilt = 2; const int pinLED_R = 10; const int pinLED_G = 9; const int pinLED_B = 8; int val = 0; void setup() { // put your setup code here, to run once: pinMode(pinLED_R, OUTPUT); pinMode(pinLED_G, OUTPUT); pinMode(pinLED_B, OUTPUT); Serial.begin(9600); } void loop() { // put your main code here, to run repeatedly: val = analogRea..

온도센서가 상온에 있을 때 : RGB 모듈이 파란색 ON 온도센서를 손으로 잡았을 때 : RGB 모듈이 빨간색 ON const int pinLM35 = 1; const int pinLED_R = 10; const int pinLED_G = 9; const int pinLED_B = 8; int val = 0; void setup() { // put your setup code here, to run once: pinMode(pinLED_R, OUTPUT); pinMode(pinLED_G, OUTPUT); pinMode(pinLED_B, OUTPUT); Serial.begin(9600); } void loop() { // put your main code here, to run repeatedly: val..