tomasz_gurajek

Dependencies:   mbed

Revision:
0:f5e4c88886a5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Aug 01 10:16:27 2020 +0000
@@ -0,0 +1,20 @@
+#include "mbed.h"
+Serial pc(USBTX, USBRX); // tx, rx //defines an object called pc of class serial ,and point it at the USB port
+PwmOut led(LED1);                  //Pwm stands for puls with modulations and led is an object of clas PwmOut
+float brightness = 0.0;            //brightness is a variable of type float (whitch means real number 
+int main() {
+ pc.printf("Press 'u' to turn LED1 brightness up, 'd' to turn it down\n"); //output a massage at the start ,once
+ while(1) {                        //do"forever"
+ char c = pc.getc();               //defines a variable c of type char and sets it to a character recived from TeraTerm
+ if((c == 'u') && (brightness < 0.5)) {
+     pc.putc('^');                 //press U to show on teraterm ^
+ brightness += 0.01;               //equivalent to brightness=brightness + 0.01
+ led = brightness;
+ }
+ if((c == 'd') && (brightness > 0.0)) {
+     pc.putc('v');                 //press D to show on teraterm v
+ brightness -= 0.01;
+ led = brightness;
+ }
+ }
+} 
\ No newline at end of file