Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
You are viewing an older revision! See the latest version
RGB Led
Nachfolgend ein Beispielprogramm für die Grundfareben:
Information
Die RGB-LED hat eine gemeinsame Anode, sodass "0" eingeschaltet und "1" ausgeschaltet ist. Für PWM gilt: Je näher 0.0 desto heller und je näher 1.0 desto schwächer. Verwende (1.0 - Wert) zum Invertieren.
.ino
#define mbedLED_R 0 // GPIO00 #define mbedLED_G 2 // GPIO02 #define mbedLED_B 15 // GPIO15 void setup(){ pinMode(mbedLED_R, OUTPUT); pinMode(mbedLED_G, OUTPUT); pinMode(mbedLED_B, OUTPUT); } void loop(){ digitalWrite(mbedLED_R, !digitalRead(mbedLED_R)); delay(1000); digitalWrite(mbedLED_G, !digitalRead(mbedLED_G)); delay(1000); digitalWrite(mbedLED_B, !digitalRead(mbedLED_B)); delay(1000); }