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.
Dependencies: mbed
main.cpp@0:3231a9b1147f, 2017-09-19 (annotated)
- Committer:
- Annelotte
- Date:
- Tue Sep 19 14:18:48 2017 +0000
- Revision:
- 0:3231a9b1147f
- Child:
- 1:2a6e34a26b8a
Eerste versie met het dimmen van 1 LED
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Annelotte | 0:3231a9b1147f | 1 | #include "mbed.h" |
| Annelotte | 0:3231a9b1147f | 2 | |
| Annelotte | 0:3231a9b1147f | 3 | AnalogIn potmeter(A1); //Analog input of the potmeter |
| Annelotte | 0:3231a9b1147f | 4 | PwmOut led2(D6); //Biorobotics LED connect (D6) |
| Annelotte | 0:3231a9b1147f | 5 | PwmOut led1(D5); //Biorobotics LED connect (D5) |
| Annelotte | 0:3231a9b1147f | 6 | |
| Annelotte | 0:3231a9b1147f | 7 | float PwmPeriod = 1.0/5000.0; //PWM period (5000 Hz) |
| Annelotte | 0:3231a9b1147f | 8 | |
| Annelotte | 0:3231a9b1147f | 9 | int mmain() { |
| Annelotte | 0:3231a9b1147f | 10 | led2.period(PwmPeriod); //Set PWM period at 5000 Hz |
| Annelotte | 0:3231a9b1147f | 11 | |
| Annelotte | 0:3231a9b1147f | 12 | while(true){ |
| Annelotte | 0:3231a9b1147f | 13 | led2 = potmeter.read(); //Set brightness of let (0,1) |
| Annelotte | 0:3231a9b1147f | 14 | wait(0.1f); |
| Annelotte | 0:3231a9b1147f | 15 | } |
| Annelotte | 0:3231a9b1147f | 16 | } |