Předělání RGB LED na array.
This commit is contained in:
+18
-18
@@ -7,9 +7,9 @@
|
||||
constexpr byte ENCODER_CLK_PIN = 11;
|
||||
constexpr byte ENCODER_DT_PIN = 12;
|
||||
constexpr byte BUTTON_PIN = 2;
|
||||
constexpr byte RGB_RED_PIN = 3;
|
||||
constexpr byte RGB_GREEN_PIN = 5;
|
||||
constexpr byte RGB_BLUE_PIN = 6;
|
||||
|
||||
constexpr byte RGB_LED[] = {2, 5, 6};
|
||||
|
||||
constexpr byte SERVO_PIN = 9;
|
||||
constexpr byte BUZZER_PIN = 8;
|
||||
|
||||
@@ -82,28 +82,28 @@ void ConfirmSound() {
|
||||
}
|
||||
|
||||
void OpenLED() {
|
||||
analogWrite(RGB_GREEN_PIN, 120);
|
||||
analogWrite(RGB_BLUE_PIN, 0);
|
||||
analogWrite(RGB_RED_PIN, 0);
|
||||
analogWrite(RGB_LED[1], 120);
|
||||
analogWrite(RGB_LED[2], 0);
|
||||
analogWrite(RGB_LED[0], 0);
|
||||
}
|
||||
|
||||
void CloseLED() {
|
||||
analogWrite(RGB_GREEN_PIN, 0);
|
||||
analogWrite(RGB_BLUE_PIN, 0);
|
||||
analogWrite(RGB_RED_PIN, 120);
|
||||
analogWrite(RGB_LED[1], 0);
|
||||
analogWrite(RGB_LED[2], 0);
|
||||
analogWrite(RGB_LED[0], 120);
|
||||
}
|
||||
|
||||
void NeutralLED() {
|
||||
analogWrite(RGB_GREEN_PIN, 0);
|
||||
analogWrite(RGB_BLUE_PIN, 120);
|
||||
analogWrite(RGB_RED_PIN, 0);
|
||||
analogWrite(RGB_LED[1], 0);
|
||||
analogWrite(RGB_LED[2], 120);
|
||||
analogWrite(RGB_LED[0], 0);
|
||||
}
|
||||
|
||||
void BlockedLED() {
|
||||
const bool blink = millis() / 500 % 2 == 0;
|
||||
analogWrite(RGB_RED_PIN, blink ? 120 : 0);
|
||||
analogWrite(RGB_GREEN_PIN, 0);
|
||||
analogWrite(RGB_BLUE_PIN, 0);
|
||||
analogWrite(RGB_LED[0], blink ? 120 : 0);
|
||||
analogWrite(RGB_LED[1], 0);
|
||||
analogWrite(RGB_LED[2], 0);
|
||||
}
|
||||
|
||||
void showEntryScreen(const bool showValue) {
|
||||
@@ -209,9 +209,9 @@ void setup() {
|
||||
Serial.println("Nastavování pinů");
|
||||
|
||||
pinMode(BUTTON_PIN, INPUT); Serial.println("Piny: 1/8");
|
||||
pinMode(RGB_RED_PIN, OUTPUT); Serial.println("Piny: 2/8");
|
||||
pinMode(RGB_GREEN_PIN, OUTPUT); Serial.println("Piny: 3/8");
|
||||
pinMode(RGB_BLUE_PIN, OUTPUT); Serial.println("Piny: 4/8");
|
||||
pinMode(RGB_LED[0], OUTPUT); Serial.println("Piny: 2/8");
|
||||
pinMode(RGB_LED[1], OUTPUT); Serial.println("Piny: 3/8");
|
||||
pinMode(RGB_LED[2], OUTPUT); Serial.println("Piny: 4/8");
|
||||
pinMode(ENCODER_CLK_PIN, INPUT); Serial.println("Piny: 5/8");
|
||||
pinMode(ENCODER_DT_PIN, INPUT); Serial.println("Piny: 6/8");
|
||||
pinMode(SERVO_PIN, OUTPUT); Serial.println("Piny: 7/8");
|
||||
|
||||
Reference in New Issue
Block a user