본문 바로가기

Embedded

(80)
arduino v220714 전체LED제어 #define RED_LED 13 #define BLUE_LED 8 #define GREEN_LED 12 int interval = 200; int ledArr[] = {11,10,9,6,5,3}; int ledSize = sizeof(ledArr)/sizeof(int); String mode="OFF"; unsigned long previousMillis = 0; void setup() { Serial.begin(9600); pinMode(RED_LED,OUTPUT); pinMode(BLUE_LED,OUTPUT); pinMode(GREEN_LED,OUTPUT); for(int i=0; i 0){ mode = Serial.readStringUntil('\n'); Serial.print(mo..
lilypad_v220713 좌측(A2,A3,A4) 깜빡이기 / 우측(11,10,9) FADE #define UP 0 #define DOWN 1 int pwmArr[] = {11,10,9}; int blinkArr[]={A4,A3,A2}; int pwmSize = sizeof(pwmArr) / sizeof(pwmArr[0]); int blinkSize = sizeof(blinkArr) / sizeof(blinkArr[0]); const int minPWM = 0; const int maxPWM = 255; byte fadeDirection = UP; int fadeValue = 0; byte fadeIncrement = 5; unsigned long previousFadeMillis; unsigned long previousMill..
Arduino v220712 아기상어 + LED 깜빡이기 #define NOTE_C4 262 #define NOTE_D4 294 #define NOTE_E4 330 #define NOTE_F4 349 #define NOTE_G4 392 #define NOTE_A4 440 #define PIEZO_PIN 8 int ledArr[] = {9,6,5,3}; int ledSize = sizeof(ledArr)/sizeof(int); //notes in the melody: int melody[] = { NOTE_C4, NOTE_D4, NOTE_F4, NOTE_F4, NOTE_F4, NOTE_F4, NOTE_F4, NOTE_F4, NOTE_F4, NOTE_C4, NOTE_D4, NOTE_F4, NOTE_F4, NOTE_F4, NOTE_F4,..
lilyPad v220708 -2 #조도센서 + LED깜빡이기 #define THR 200 #define PIEZOPIN 2 #define LED_FADE 0 int ledArr[] = {10,9,3,A4,A3,A2}; // 사용하는 LED번호 int ledSize = sizeof(ledArr)/ sizeof(ledArr[0]); int ledCount = 0; int flag = 0; int modeCount = 0; int fadeCount = 0; int fadeDirection = 1; unsigned long fade_previousMillis = 0; unsigned long previousMillis = 0; const long fade_interval = 20; const long interval = 150; void se..
lilyPad v220708 #포토레지스터 + LED깜빡이기 #define THR 200 #define PIEZOPIN 2 #define LED_FADE 0 int ledArr[] = {11,10,9,3}; // 사용하는 LED번호 int ledSize = sizeof(ledArr)/ sizeof(ledArr[0]); int ledCount = 0; int flag = 0; int modeCount = 0; int fadeCount = 0; int fadeDirection = 1; unsigned long fade_previousMillis = 0; unsigned long previousMillis = 0; const long fade_interval = 20; const long interval = 150; void setup(..
lilyPad v220707 아기상어 #define NOTE_B0 31 #define NOTE_C1 33 #define NOTE_CS1 35 #define NOTE_D1 37 #define NOTE_DS1 39 #define NOTE_E1 41 #define NOTE_F1 44 #define NOTE_FS1 46 #define NOTE_G1 49 #define NOTE_GS1 52 #define NOTE_A1 55 #define NOTE_AS1 58 #define NOTE_B1 62 #define NOTE_C2 65 #define NOTE_CS2 69 #define NOTE_D2 73 #define NOTE_DS2 78 #define NOTE_E2 82 #define NOTE_F2 87 #define NOTE_FS2 93 #defi..
Arduino_220706 https://arduino.stackexchange.com/questions/17355/playing-melody-with-tone-without-using-delay #노래 두곡 번갈아 재생 #define NOTE_B0 31 #define NOTE_C1 33 #define NOTE_CS1 35 #define NOTE_D1 37 #define NOTE_DS1 39 #define NOTE_E1 41 #define NOTE_F1 44 #define NOTE_FS1 46 #define NOTE_G1 49 #define NOTE_GS1 52 #define NOTE_A1 55 #define NOTE_AS1 58 #define NOTE_B1 62 #define NOTE_C2 65 #define NOTE_CS2 6..
Arduino v220704 void setup() { pinMode(8, OUTPUT); pinMode(9, OUTPUT); pinMode(10, OUTPUT); } void loop() { digitalWrite(8, LOW); digitalWrite(9, LOW); digitalWrite(10, LOW); delay(1000); // Wait for 1000 millisecond(s) digitalWrite(8, HIGH); delay(1000); // Wait for 1000 millisecond(s) digitalWrite(8, LOW); digitalWrite(9, HIGH); delay(1000); // Wait for 1000 millisecond(s) digitalWrite(9, LOW); digitalWrite(1..