Mbed

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
besam
Date:
Tue Jan 14 23:09:29 2020 +0000
Commit message:
Letzte Version

Changed in this revision

Mbed_Dig_Out_Class_Reffernce.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 645b1d3bcc9d Mbed_Dig_Out_Class_Reffernce.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Mbed_Dig_Out_Class_Reffernce.cpp	Tue Jan 14 23:09:29 2020 +0000
@@ -0,0 +1,24 @@
+#include "mbed.h"
+ 
+DigitalOut led1(LED1);    // Create a DigitalOut connected to the specified pin. 
+DigitalOut led2(LED2, 0); // Create a DigitalOut connected to the specified pin and initialize with 0
+DigitalOut led3(LED3);
+DigitalOut led4(LED4);
+ 
+int value = 1;
+ 
+int main(void) {
+    led1.write(1);      // Set the output, specified as 0 or 1 (int)
+    led2 = 1;           // DigitalOut & operator= (int value) - A shorthand for write() 
+    led3 = value;       // DigitalOut & operator= (int value) - A shorthand for write()     
+    led4 = led3;        // DigitalOut & operator= (DigitalOut &rhs) - A shorthand for write() using the assignment operator which copies the state from the DigitalOut argument.
+ 
+    if(led2.is_connected ()) {  // Return the output setting, represented as 0 or 1 
+        if(led2.read() )        // Return the output setting, represented as 0 or 1 (int)
+            printf("%d %d\n", led1.read(), led2.read());    
+    }   
+    if(led2)                    // operator int () - A shorthand for read()
+        printf("%d %d\n", led3.read(), led4.read());    
+ 
+    return 0;
+}
\ No newline at end of file
diff -r 000000000000 -r 645b1d3bcc9d mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Jan 14 23:09:29 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file