homayoun mh
/
Arduino_Blink
Arduino_Blink sample code ported.
main.cpp@0:516ad7c37471, 2014-09-03 (annotated)
- Committer:
- homayoun
- Date:
- Wed Sep 03 10:25:31 2014 +0000
- Revision:
- 0:516ad7c37471
Arduino_Blink
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
homayoun | 0:516ad7c37471 | 1 | #include "mbed.h" |
homayoun | 0:516ad7c37471 | 2 | |
homayoun | 0:516ad7c37471 | 3 | DigitalOut myled(LED1); // Instead of "pinMode(led, OUTPUT);" function, this creates an object called "myled", to be used later. |
homayoun | 0:516ad7c37471 | 4 | |
homayoun | 0:516ad7c37471 | 5 | // the setup routine runs once when you press reset: |
homayoun | 0:516ad7c37471 | 6 | void setup() |
homayoun | 0:516ad7c37471 | 7 | { |
homayoun | 0:516ad7c37471 | 8 | |
homayoun | 0:516ad7c37471 | 9 | } |
homayoun | 0:516ad7c37471 | 10 | |
homayoun | 0:516ad7c37471 | 11 | // the loop routine runs over and over again forever: |
homayoun | 0:516ad7c37471 | 12 | void loop() |
homayoun | 0:516ad7c37471 | 13 | { |
homayoun | 0:516ad7c37471 | 14 | myled = 1; // Instead of "digitalWrite(led, HIGH);" |
homayoun | 0:516ad7c37471 | 15 | wait(1.0); // Instead of "delay(1000);" |
homayoun | 0:516ad7c37471 | 16 | myled = 0; // Instead of "digitalWrite(led, LOW);" |
homayoun | 0:516ad7c37471 | 17 | wait(1.0); // Instead of "delay(1000);" |
homayoun | 0:516ad7c37471 | 18 | } |
homayoun | 0:516ad7c37471 | 19 | |
homayoun | 0:516ad7c37471 | 20 | int main() |
homayoun | 0:516ad7c37471 | 21 | { |
homayoun | 0:516ad7c37471 | 22 | setup(); |
homayoun | 0:516ad7c37471 | 23 | while(1) loop(); |
homayoun | 0:516ad7c37471 | 24 | } |