Easy for debugging hardware/software
Toggle library easy for debugging based on : https://developer.mbed.org/cookbook/Writing-a-Library
toggle.cpp@3:47392208fe6d, 2016-06-11 (annotated)
- Committer:
- qynx
- Date:
- Sat Jun 11 13:25:17 2016 +0000
- Revision:
- 3:47392208fe6d
- Parent:
- 1:27360e9dc2c5
remove test.cpp
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
qynx | 0:847ab1eb73cf | 1 | #include "toggle.h" |
qynx | 0:847ab1eb73cf | 2 | #include "mbed.h" |
qynx | 0:847ab1eb73cf | 3 | |
qynx | 0:847ab1eb73cf | 4 | |
qynx | 1:27360e9dc2c5 | 5 | Toggle::Toggle(PinName pin) : _p(pin) |
qynx | 0:847ab1eb73cf | 6 | { |
qynx | 0:847ab1eb73cf | 7 | _p = 0; |
qynx | 0:847ab1eb73cf | 8 | } |
qynx | 0:847ab1eb73cf | 9 | |
qynx | 1:27360e9dc2c5 | 10 | void Toggle::toggle(int n) |
qynx | 0:847ab1eb73cf | 11 | { |
qynx | 0:847ab1eb73cf | 12 | for(int i=0; i<n*2; i++) { |
qynx | 0:847ab1eb73cf | 13 | _p = !_p; |
qynx | 0:847ab1eb73cf | 14 | wait(0.2); |
qynx | 0:847ab1eb73cf | 15 | } |
qynx | 0:847ab1eb73cf | 16 | } |