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.
Lösung HasPwm
#define LED_RED p36 class HasP { private: PwmOut _led; public: HasP(PwmOut ld) : _led(ld) {}; void LedOn() { for( float i=0.0; i <=1.0; i+=0.1 ) { _led = i; wait_ms(200); } } void LedOff(){ _led.write(0); } }; int main() { // IsP red(LED_RED); HasP red(LED_RED); while(1) { red.LedOn(); // dimmt wait(1); red.LedOff(); } }
Alternativ schreiben Sie eine Klasse IsP mit Vererbung.