Update nach erstem Aufbau in der Stadtbib

This commit is contained in:
Andreas committed 2026-04-09 17:02:31 +02:00
1 parent b758784969
commit 75ce71f4df
8 files changed
+284

No files matched your search

+54
View File
@@ -0,0 +1,54 @@
#include <FastLED.h>
// How many leds in your strip?
#define NUM_LEDS 60
// For led chips like Neopixels, which have a data line, ground, and power, you just
// need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock,
// ground, and power), like the LPD8806, define both DATA_PIN and CLOCK_PIN
#define DATA_PIN 11
#define CLOCK_PIN 13
// Define the array of leds
CRGB leds[NUM_LEDS];
void setup() {
Serial.begin(57600);
Serial.println("resetting");
FastLED.addLeds<WS2812,DATA_PIN,RGB>(leds,NUM_LEDS);
FastLED.setBrightness(84);
}
void fadeall() { for(int i = 0; i < NUM_LEDS; i++) { leds[i].nscale8(250); } }
void loop() {
static uint8_t hue = 0;
Serial.print("x");
// First slide the led in one direction
for(int i = 0; i < NUM_LEDS; i++) {
// Set the i'th led to red
leds[i] = CHSV(hue++, 255, 255);
// Show the leds
FastLED.show();
// now that we've shown the leds, reset the i'th led to black
// leds[i] = CRGB::Black;
fadeall();
// Wait a little bit before we loop around and do it again
delay(10);
}
Serial.print("x");
// Now go in the other direction.
for(int i = (NUM_LEDS)-1; i >= 0; i--) {
// Set the i'th led to red
leds[i] = CHSV(hue++, 255, 255);
// Show the leds
FastLED.show();
// now that we've shown the leds, reset the i'th led to black
// leds[i] = CRGB::Black;
fadeall();
// Wait a little bit before we loop around and do it again
delay(10);
}
}
+53
View File
@@ -0,0 +1,53 @@
#include <FastLED.h>
// How many leds in your strip?
#define NUM_LEDS 240
#define BASE_LEDS 60
// For led chips like Neopixels, which have a data line, ground, and power, you just
// need to define DATA_PIN. For led chipsets that are SPI based (four wires - data, clock,
// ground, and power), like the LPD8806, define both DATA_PIN and CLOCK_PIN
#define DATA_PIN 14
#define CLOCK_PIN 13
// Define the array of leds
CRGB leds[NUM_LEDS];
void setup() {
Serial.begin(57600);
Serial.println("resetting");
FastLED.addLeds<WS2812,DATA_PIN,RGB>(leds,NUM_LEDS);
FastLED.setBrightness(84);
}
// Sets LED i and all its mirrored positions:
// i, 120-i, 120+i, 180-i, 180+i
void setMirroredLED(int i, CHSV color) {
leds[i] = color;
if (120 - i >= 0 && 120 - i < NUM_LEDS) leds[119 - i] = color;
if (120 + i < NUM_LEDS) leds[120 + i] = color;
if (180 + i < NUM_LEDS) leds[240 - i] = color;
}
void fadeall() { for(int i = 0; i < NUM_LEDS; i++) { leds[i].nscale8(250); } }
void loop() {
static uint8_t hue = 0;
Serial.print("x");
// First slide the led in one direction
for(int i = 0; i < BASE_LEDS; i++) {
setMirroredLED(i, CHSV(hue++, 255, 255));
FastLED.show();
fadeall();
delay(10);
}
Serial.print("x");
// Now go in the other direction.
for(int i = (BASE_LEDS)-1; i >= 0; i--) {
setMirroredLED(i, CHSV(hue++, 255, 255));
FastLED.show();
fadeall();
delay(10);
}
}
+83
View File
@@ -0,0 +1,83 @@
# Wiring LED Strip
* 240 LEDs
* start of every LED strip is at the female connector
* green: data
* red: 5 VCC
* white: GND
* connect green to DATA_PIN 14, which is A0 on the Arduino
## Wiring with External Power Source (highly recommended)
5V PSU USB → Arduino
└── GND pin ─────────────────┐
└── Data pin (A0) ──────┐ │
│ │
5V PSU ──── VCC ──→ LED Strip DAT GND
└─── GND ──→ LED Strip ───────────────┘
# Wiring Guide: 12 Push Buttons + WS2812B LED Strip on Arduino Uno
## Available I/O Pins on Arduino Uno
| Pin Group | Total | Usable | Notes |
|---|---|---|---|
| Digital D0–D13 | 14 | 12 | Avoid D0/D1 — used for Serial TX/RX |
| Analog A0–A5 | 6 | 6 | Can be used as digital I/O |
| **Total usable** | | **18** | |
## Pin Requirements
- 12 push buttons = 12 pins
- WS2812B data line = 1 pin
- **Total: 13 pins** (fits within the Uno's 18 usable pins)
## Suggested Pin Assignment
| Component | Pin |
|---|---|
| Button 1 | D2 |
| Button 2 | D3 |
| Button 3 | D4 |
| Button 4 | D5 |
| Button 5 | D6 |
| Button 6 | D7 |
| Button 7 | D8 |
| Button 8 | D9 |
| Button 9 | D10 |
| Button 10 | D11 |
| Button 11 | D12 |
| Button 12 | D13 |
| WS2812B data | A0 (used as digital out) |
| A1–A5 | free for future use |
## Button Wiring
Use `INPUT_PULLUP` — no external resistors needed.
- Connect each button between its digital pin and **GND**
- Button reads **LOW** when pressed, **HIGH** when released
```cpp
pinMode(buttonPin, INPUT_PULLUP);
```
## WS2812B Wiring
The strip only requires one data pin.
```cpp
#define LED_PIN A0
#define NUM_LEDS 30
CRGB leds[NUM_LEDS];
FastLED.addLeds<WS2812B, LED_PIN, GRB>(leds, NUM_LEDS);
```
### Power Warning
Each WS2812B LED at full white draws ~60mA. If you have more than ~8–10 LEDs:
- Power the strip from an **external 5V supply**, not the Uno's 5V pin
- Share a **common GND** between the external supply, the LED strip, and the Arduino Uno
+26
View File
@@ -0,0 +1,26 @@
Thermometer: 4 * 60 LEDs
alle LEDs immer an (für Farbe, den Farbverlauf muss ich noch finden, hatte da aber mal einen von blau nach rot erstellt)
mit Status "an" (starke Helligkeit) und "aus" (niedrige Helligkeit)
Baselevel bei Start/Reset: 30 LEDs "an"
Thermometer ist in 8 Sections aufgeteilt (4 Sections unter der Mitte, 4 darüber) mit jeweils 7.5 Lichtern (Umsetzung? Alternativ nur 56LEDs benutzen, damit jeweils 7 Lichter pro Section - da könnten wir einfach 4 LEDs wirklich aus lassen, die tun ja kaum was zur Sache visuell; neue Baseline "Mitte" dann bei 28 LEDs)
4 Fragen, pro Frage 3 Knöpfe
2 Knöpfe sind "falsch", 1 Knopf "richtig"
bei falsch: Temperatur geht hoch - 1 Section geht an (aka 7 Lichter hoch)
bei richtig: Temperatur geht runter - 1 Section geht aus (aka 7 Lichter runter)
pro Frage nicht mehr als 1 Section an/aus; wenn Knöpfe der gleichen Frage gedrückt werden, gleiche Section ansprechen?
+ Animation für an/aus, also zB dass die Lichter in Reihe an/aus gehen, ggf. Animation für gleiche Section sogar 2-3 wiederholen für visuelle Deutlichkeit
Ziel ist es, die 4 richtige Knöpfe zu drücken - dann wäre Thermometer auf "0"
--> Win Animation folgt (bunter Regenbogen, der hoch und runter spielt)
andere Ideen:
- Reset-Knopf, womit wieder Baseline mit 30/28 LEDs gesetzt wird
- Cooldown für die Knöpfe?
angehängte Skripte:
- potentielle Win-Animation
+35
View File
@@ -0,0 +1,35 @@
/*
- Wiring: connect each button between its pin and GND — no resistors needed.
- Open the Serial Monitor at 9600 baud in the Arduino IDE to see the output.
*/
const int NUM_BUTTONS = 12;
const int BUTTON_PINS[NUM_BUTTONS] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
bool lastState[NUM_BUTTONS];
void setup() {
Serial.begin(9600);
for (int i = 0; i < NUM_BUTTONS; i++) {
pinMode(BUTTON_PINS[i], INPUT_PULLUP);
lastState[i] = HIGH;
}
Serial.println("Button test ready. Press a button!");
}
void loop() {
for (int i = 0; i < NUM_BUTTONS; i++) {
bool currentState = digitalRead(BUTTON_PINS[i]);
if (currentState == LOW && lastState[i] == HIGH) {
Serial.print("Button ");
Serial.print(i + 1);
Serial.print(" pressed! (pin D");
Serial.print(BUTTON_PINS[i]);
Serial.println(")");
}
lastState[i] = currentState;
}
delay(50); // simple debounce
}
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

+6
View File
@@ -0,0 +1,6 @@
# Stand 09.04
* Netzteil für Arduino (LED Strip geht wohl auch ohne zusätzlichen Strom), aber schadet nichts
* Zweites Netzteil für den Arduino selber
* USB Kabel mit USB Type-B Port auf Arduino Seite
+27
View File
@@ -0,0 +1,27 @@
# Used Hardware
## Arduino Uno
## LED Strip für "Thermometer"
* https://www.roboter-bausatz.de/p/1-meter-ws2812b-led-strip-wasserdicht-5050rgb-dc5v-60leds-m
* davon 4 Stück in Reihe (kann man zusammenstecken)
## Buttons
Specification:
Rated voltage and current: DC/AC 250V 3A
Material: aluminium alloy, stainless steel.
Mounting Hole Diameter: 19mm
Contact configuration: 1NO
Operating type: Momentary switch
The front shape: flat head/round
Protection class: IP65, IK08.
Contact resistance: ≤50mΩ.
Insulation resistance: ≥1000mΩ.
Dielectric strength: 2000 VAC
Operating temperature: -20°C to +55°C.
Mechanical life: > 1,000,000 times.
Electrical life: > 200,000 times.
Package contents:
4 x push button switches.