A sample test run program to monitor LED blinking and controlling various aspects of it.
Dependencies: mbed
main.cpp@0:04e7f2798a30, 2018-11-08 (annotated)
- Committer:
- priyanshu_varshney
- Date:
- Thu Nov 08 17:55:17 2018 +0000
- Revision:
- 0:04e7f2798a30
Sample program LED blinking;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
priyanshu_varshney | 0:04e7f2798a30 | 1 | #include "mbed.h" |
priyanshu_varshney | 0:04e7f2798a30 | 2 | #include<iostream> |
priyanshu_varshney | 0:04e7f2798a30 | 3 | using namespace std; |
priyanshu_varshney | 0:04e7f2798a30 | 4 | |
priyanshu_varshney | 0:04e7f2798a30 | 5 | DigitalOut myled(LED4); |
priyanshu_varshney | 0:04e7f2798a30 | 6 | DigitalOut myled2(LED2); |
priyanshu_varshney | 0:04e7f2798a30 | 7 | |
priyanshu_varshney | 0:04e7f2798a30 | 8 | int main() { |
priyanshu_varshney | 0:04e7f2798a30 | 9 | int n =5; |
priyanshu_varshney | 0:04e7f2798a30 | 10 | while(n--) { |
priyanshu_varshney | 0:04e7f2798a30 | 11 | myled = 1; |
priyanshu_varshney | 0:04e7f2798a30 | 12 | myled2 = 1; |
priyanshu_varshney | 0:04e7f2798a30 | 13 | wait(0.5); |
priyanshu_varshney | 0:04e7f2798a30 | 14 | myled = 0; |
priyanshu_varshney | 0:04e7f2798a30 | 15 | myled2 = 0; |
priyanshu_varshney | 0:04e7f2798a30 | 16 | wait(0.2); |
priyanshu_varshney | 0:04e7f2798a30 | 17 | } |
priyanshu_varshney | 0:04e7f2798a30 | 18 | myled = 1; |
priyanshu_varshney | 0:04e7f2798a30 | 19 | myled2= 1; |
priyanshu_varshney | 0:04e7f2798a30 | 20 | } |