First Commit
This commit is contained in:
32
DimmLight.ino/DimmLight.ino.ino
Normal file
32
DimmLight.ino/DimmLight.ino.ino
Normal file
@@ -0,0 +1,32 @@
|
||||
//**** INCLUDES *************************************************************
|
||||
|
||||
//**** CONSTANTS ************************************************************
|
||||
|
||||
//**** PIN ASSIGNMENT OF OUR SHIELD *****************************************
|
||||
static const int buttonLeft = D7;
|
||||
static const int buttonRight = D6;
|
||||
static const int ledBlue = D5;
|
||||
static const int ledRed = D3;
|
||||
static const int ldr = A0;
|
||||
static const int buzzer = 26;
|
||||
|
||||
//**** SETUP ****************************************************************
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
|
||||
pinMode(buttonLeft, INPUT_PULLUP);
|
||||
pinMode(buttonRight, INPUT_PULLUP);
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
pinMode(ledBlue, OUTPUT);
|
||||
pinMode(ledRed, OUTPUT);
|
||||
pinMode(buzzer, OUTPUT);
|
||||
pinMode(ldr, INPUT);
|
||||
}
|
||||
|
||||
//**** LOOP *****************************************************************
|
||||
void loop() {
|
||||
|
||||
int Brightness = map(analogRead(ldr), 0, 1023, 255, 0);
|
||||
analogWrite(ledBlue, Brightness);
|
||||
delay(70);
|
||||
}
|
||||
Reference in New Issue
Block a user