Opdracht 1 met de motor. Functioneert nog niet.

Dependencies:   mbed

main.cpp

Committer:
Annelotte
Date:
2017-09-19
Revision:
0:3231a9b1147f
Child:
1:2a6e34a26b8a

File content as of revision 0:3231a9b1147f:

#include "mbed.h"

AnalogIn potmeter(A1);  //Analog input of the potmeter
PwmOut led2(D6);        //Biorobotics LED connect (D6)
PwmOut led1(D5);        //Biorobotics LED connect (D5)

float PwmPeriod = 1.0/5000.0;   //PWM period (5000 Hz)

int mmain() {
    led2.period(PwmPeriod);      //Set PWM period at 5000 Hz
    
    while(true){
        led2 = potmeter.read();  //Set brightness of let (0,1)
        wait(0.1f);
    }
}