Liam McHale
/
labq1sat
Lab instrumentation Q1
main.cpp
- Committer:
- liammchale
- Date:
- 2020-07-18
- Revision:
- 0:4e4b546e1d74
File content as of revision 0:4e4b546e1d74:
#include"mbed.h" Serial pc(USBTX,USBRX);//tx,rx PwmOut led(LED1); float brightness=0.0; int main(){ pc.printf("Press'u'toturnLED1brightnessup,'d'toturnitdown\n"); while(1){ char c=pc.getc(); if((c=='u')&&(brightness<0.5)){ brightness+=0.01; led = brightness; }if((c=='d')&&(brightness>0.0)){ brightness-=0.01; led=brightness; } } }