projekte:sekwai:rp2040_arduino
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| projekte:sekwai:rp2040_arduino [2025/08/01 21:39] – [Testprojekt] dominik | projekte:sekwai:rp2040_arduino [2025/08/02 06:23] (current) – [Bootmodus RP2040] dominik | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== RP2040 Arduino ====== | ====== RP2040 Arduino ====== | ||
| - | ===== Autpmount | + | ===== Automount |
| * https:// | * https:// | ||
| + | * '' | ||
| + | * '' | ||
| + | |||
| + | ===== Bootmodus RP2040 ===== | ||
| + | Der RP2040 (und RP235x) können in den Bootmodus versetzt werden wenn die serielle Schnittstelle eingebunden ist (die über USB). | ||
| + | Dann reicht ein Baudrate setzen auf 1200 und Port Close um den Bootmodus zu aktivieren. | ||
| + | |||
| + | * '' | ||
| + | * <code python | boot.py> | ||
| + | import serial | ||
| + | import sys | ||
| + | |||
| + | if len(sys.argv) != 2: | ||
| + | print(" | ||
| + | sys.exit(1) | ||
| + | |||
| + | port = sys.argv[1] | ||
| + | try: | ||
| + | ser = serial.Serial(port, | ||
| + | ser.close() | ||
| + | print(f" | ||
| + | except Exception as e: | ||
| + | print(f" | ||
| + | sys.exit(1) | ||
| + | </ | ||
| + | * '' | ||
| + | |||
| + | **Bootmodus verlassen** | ||
| + | * '' | ||
| ===== Installation CLI ===== | ===== Installation CLI ===== | ||
| Line 31: | Line 60: | ||
| * <code c++ | ws2812.ino> | * <code c++ | ws2812.ino> | ||
| #include < | #include < | ||
| - | |||
| - | // WS2812 LED an GPIO16 (bit-banging, | ||
| - | #define LED_PIN 16 | ||
| - | #define LED_COUNT 1 // Eine LED | ||
| - | |||
| - | // Funktion zum Senden eines Bits an WS2812 (Timing für RP2040 angepasst) | ||
| - | void sendBit(bool bit) { | ||
| - | if (bit) { | ||
| - | digitalWrite(LED_PIN, | ||
| - | delayMicroseconds(800); | ||
| - | digitalWrite(LED_PIN, | ||
| - | delayMicroseconds(450); | ||
| - | } else { | ||
| - | digitalWrite(LED_PIN, | ||
| - | delayMicroseconds(400); | ||
| - | digitalWrite(LED_PIN, | ||
| - | delayMicroseconds(850); | ||
| - | } | ||
| - | } | ||
| - | |||
| - | // Funktion zum Senden einer Farbe (GRB-Format für WS2812) | ||
| - | void sendColor(uint8_t r, uint8_t g, uint8_t b) { | ||
| - | // Sende G (8 Bits) | ||
| - | for (int i = 7; i >= 0; i--) sendBit((g >> i) & 1); | ||
| - | // Sende R | ||
| - | for (int i = 7; i >= 0; i--) sendBit((r >> i) & 1); | ||
| - | // Sende B | ||
| - | for (int i = 7; i >= 0; i--) sendBit((b >> i) & 1); | ||
| - | delayMicroseconds(50); | ||
| - | } | ||
| void setup() { | void setup() { | ||
| Serial.begin(115200); | Serial.begin(115200); | ||
| while (!Serial); | while (!Serial); | ||
| - | |||
| - | pinMode(LED_PIN, | ||
| - | digitalWrite(LED_PIN, | ||
| - | |||
| Serial.println(" | Serial.println(" | ||
| - | Serial.println(" | ||
| } | } | ||
| void loop() { | void loop() { | ||
| - | | + | Serial.println(" |
| - | sendColor(255, | + | Serial.println(" |
| - | | + | |
| - | | + | |
| - | + | ||
| - | // LED Grün | + | |
| - | sendColor(0, | + | |
| - | Serial.println(" | + | |
| - | delay(1000); | + | |
| - | + | ||
| - | // LED Blau | + | |
| - | sendColor(0, | + | |
| - | Serial.println(" | + | |
| - | delay(1000); | + | |
| - | + | ||
| - | // LED Aus | + | |
| - | sendColor(0, | + | |
| - | Serial.println(" | + | |
| - | | + | |
| } | } | ||
| </ | </ | ||
projekte/sekwai/rp2040_arduino.1754077181.txt.gz · Last modified: by dominik
