MBC002 - DigitalIn * This example use the DigitalIn function

Dependents:   steering_wheel_controls_TO_KEENWOOD_RADIO_INFRARED_INTERFACE NUCLEO_TRANSMITS_8_INFRARED_COMMANDS

Revision:
0:4265ec26da85
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun May 20 11:33:50 2018 +0000
@@ -0,0 +1,51 @@
+/**
+ * MBC002 - DigitalIn
+ * This example use the DigitalIn function
+ * 20 May 2018 - Mbed Colombia - http://mbedcolombia.wordpress.com/
+ *
+ * Board: ST-Nucleo-F446RE - https://os.mbed.com/platforms/ST-Nucleo-F446RE/
+ *
+ * Copyright [2018] [Leandro Perez Guatibonza / leandropg AT gmail DOT com]
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "mbed.h"
+
+// LED connected Pin PC_0
+DigitalOut led(PC_0);
+
+// Push-Button connected Pin PC_3
+DigitalIn pushButton(PC_3);
+
+// Main Loop runs in its own thread in the OS
+int main() {
+   
+    // Active Pull-Up Resistor
+    pushButton.mode(PullUp);
+   
+    // Inifite Loop
+    while(1) {
+        
+        // Check Push-Button
+        if(pushButton == 0) {
+            
+            // LED Turn-On
+            led = 1;
+            
+        } else {
+            
+            // LED Turn-Off
+            led = 0;
+        }
+    }
+}
\ No newline at end of file