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.
Homepage
Project met een motor.
Afbeelding:
Code:
- include "mbed.h"
DigitalOut motor0(p19); AnalogIn mypot(p20); PwmOut motor(p21); Serial pc(USBTX, USBRX);
int main() {
float i;
motor0 = 0;
motor.period_us(90);
pc.printf("\x1B\x48\x1B\x4A");
pc.printf("-===[ Pulse Width Modulation ]===-");
while(1){ i=mypot.read(); motor = i; pc.printf("\x1B\x48"); pc.printf("\n\n\r Duty cycle %5.1f%% ",i*100); wait(0.5); } }