Files
Arduino_Projects/DimmLight.ino/DimmLight.ino.ino
MindCreeper03 e490df1715 First Commit
2025-02-27 19:31:50 +01:00

33 lines
963 B
C++

//**** 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);
}