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.
NUCLEO AnalogIn
Das folgende Programm liest den analogen Wert des Poti am AnalogIn-Pin A3 und steuert mittels eines PwmOut-Signals den roten Anteil (D1) der RGB-Led am NUClight V3 Board.
NUCLEO-AnaloIn_Poti.cpp
#include "mbed.h" Serial pc(SERIAL_TX,SERIAL_RX); AnalogIn ain(A3); PwmOut RGBr(D1); // red LED int main(){ while(1){ pc.printf("percentage: %3.0f%%\r\n", ain.read()*100.0f); RGBr.period_ms(20.0f); // 20 mili second period RGBr.pulsewidth_ms(ain.read()*10.0f); // 5 mili second pulse (on) wait_ms(200); } }