Projectgroep 20 Biorobotics
/
Lampje
now when you turn the draaiknop the lampje will dim
main.cpp
- Committer:
- charloverwijk
- Date:
- 2017-09-19
- Branch:
- knopjes
- Revision:
- 1:c6776cafbfd9
- Parent:
- 0:ead43c4234c9
- Child:
- 2:aca5a168a6d3
File content as of revision 1:c6776cafbfd9:
#include "mbed.h" AnalogIn But2(A2); AnalogIn But1(A3); AnalogIn Pot1(A1); DigitalOut gpo(D0); PwmOut led2(D6); PwmOut led1(D5); int a=5000; float PwmPeriod= 1/a; int main() { while (true) { if (But1==true) { a=a+100; } else if (But2==true) { a=a-100; } else {} wait(0.1f); led1.period(PwmPeriod); } }