Projectgroep 20 Biorobotics / Mbed 2 deprecated College_3

Dependencies:   mbed

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?

UserRevisionLine numberNew 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 }