Charles Tritt / Mbed 2 deprecated Blink_FET_Variable

Dependencies:   mbed

Revision:
2:1f9267d3f3f4
Parent:
1:9f6f3af9aaaa
Child:
3:665ae1f64bf0
--- a/main.cpp	Wed Sep 13 18:59:14 2017 +0000
+++ b/main.cpp	Thu May 07 14:39:17 2020 +0000
@@ -1,34 +1,23 @@
 /*
-  Blink
-  Turns on an LED on for one second, then off for one second, repeatedly.
+  Project: Blink_FET
+  File: main.cpp
+  Last revised by: Dr. C. S. Tritt
+  Last revision on: 4/8/19 (v. 1.0)
+  
+  Turns on D4 for 0.7 second, then off for 0.3 second, repeatedly.
  
   This example code is in the public domain.
 */
-//  #include is a directive that "pastes" a file into your code.
-//  Use this specific #include at the beginning of each mbed program.
-//  mbed.h contains/points to the full definitions of our simple statements.
 #include "mbed.h"
-//  Define the object board_LED to be a digital output connected to LED1,
-//  which is the little green LED built into the Nucleo board.
-DigitalOut board_LED(LED1);
-/*  The "main" function defines your main program -- it executes as soon as
-    you program the board.
- 
-    Functions can return (compute and give back) a value.  The main function
-    could return an integer error code, so it begins with int.
-    
-    Functions can also accept inputs.  The main function cannot however, so
-    its round parentheses are empty.
-*/  
+//  Construct a digital output object called myD4 and connect it to D4.
+DigitalOut myD4(D4);
+  
 int main() {   // This curly brace marks the beginning of the main function.
-    // while() will repeat a set of actions as long as the statement inside
-    // its round parentheses is true. 1 is the definition of true, so
-    // while(1) and while(true) repeat forever. 
+    // Loop forever. 
     while(true) {   // This curly brace marks the start of the repeated actions.
-    
-        board_LED = 1;  // Turn on LED by storing a 1 in board_LED.
-        wait(0.5);      // wait(x) will pause for a given number of seconds.
-        board_LED = 0;  // Turn off LED by storing a 0 in board_LED.
-        wait(0.5);      // wait another 1/2 second.
-    }  // end of repeated actions  
-}  // end of main function
\ No newline at end of file
+        myD4 = 1;   // Turn on D4 by "storing" a 1 in it.
+        wait(0.7);  // wait(x) will pause for a given number of seconds.
+        myD4 = 0;   // Turn off D4 by "storing" a 0 in it.
+        wait(0.3);  // Wait another 0.3 seconds.
+    }  // end of repeated actions. 
+}  // end of main function.
\ No newline at end of file