tomasz_gurajek

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
t00204088
Date:
Sat Aug 01 10:16:27 2020 +0000
Commit message:
tomasz_gurajek

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r f5e4c88886a5 main.cpp
--- /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
diff -r 000000000000 -r f5e4c88886a5 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Aug 01 10:16:27 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file