본문 바로가기

Embedded/Arduino

(63)
LilyPad - RGB LED 제어(공통양극) int redPin = A4 int bluePin = A3; int greenPin = A2; int delayTime = 500; void setup() { pinMode(redPin, OUTPUT); pinMode(bluePin, OUTPUT); pinMode(greenPin, OUTPUT); digitalWrite(greenPin, HIGH); digitalWrite(bluePin, HIGH); digitalWrite(redPin, HIGH); } void loop() { // red only digitalWrite(redPin, LOW); delay(delayTime); digitalWrite(redPin, HIGH); delay(delayTime); // blue only digitalWrite..
Arduino - LED Blink 보호되어 있는 글입니다.
Arduino - photo센서 보호되어 있는 글입니다.
Arduino - AnalogRead() 보호되어 있는 글입니다.
Arduino - PWM Example 보호되어 있는 글입니다.
Arduino - Button Example 보호되어 있는 글입니다.
LilyPad - Photo Sensor Beep Code int photoPin=A5; int delayTime = 500; int ledArr[] = {10,9,3,2}; int ledSize = sizeof(ledArr)/sizeof(int); int min = 1023; int max = 0; void setup() { for(int i=0; i max ? inputValue : max; int ledCount = inputValue * ledSize / (max-min); serialPrint(inputValue); weightedLEDOn(4-ledCount); delay(100); } void serialPrint(int analogIn){ Serial.print("Input : "); Serial.print(analogIn); S..
LilyPad - Beep Beep Code #define PIEZO_PIN 11 #define NOTE_C4 262 #define NOTE_G3 196 #define NOTE_A3 220 #define NOTE_B3 247 #define NOTE_C4 262 int melody[] = { NOTE_C4, NOTE_G3, NOTE_G3, NOTE_A3, NOTE_G3, 0, NOTE_B3, NOTE_C4 }; int noteDurations[] = { 4, 8, 8, 4, 4, 4, 4, 4 }; void setup() { for (int thisNote = 0; thisNote < 8; thisNote++) { int noteDuration = 1000 / noteDurations[thisNote]; tone(PIEZO_PIN,..