Charles Tritt
/
PullTest
Fork of analogRead by
main.cpp@3:8b392116b2f9, 2017-10-11 (annotated)
- Committer:
- CSTritt
- Date:
- Wed Oct 11 02:29:09 2017 +0000
- Revision:
- 3:8b392116b2f9
- Parent:
- 2:e0faf9e57796
Initial version of the program used for pull-up and pull-down testing.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
CSTritt | 0:2254358fce87 | 1 | /* |
CSTritt | 3:8b392116b2f9 | 2 | Project: PullTest |
CSTritt | 0:2254358fce87 | 3 | File: main.cpp |
CSTritt | 0:2254358fce87 | 4 | |
CSTritt | 3:8b392116b2f9 | 5 | For exploring pull up, pull down and pull none behavior of F446RE boards. |
CSTritt | 3:8b392116b2f9 | 6 | Makes D2-4 pull-up, D5-7 pull-down, and D8-10 pull-none. Test currents to |
CSTritt | 3:8b392116b2f9 | 7 | power and ground to determine internal resistance. D11 used to check |
CSTritt | 3:8b392116b2f9 | 8 | default operation (should be PullNone) |
CSTritt | 0:2254358fce87 | 9 | |
CSTritt | 0:2254358fce87 | 10 | Written by: Dr. C. S. Tritt |
CSTritt | 2:e0faf9e57796 | 11 | Created: 3/27/17 (v. 1.1) |
CSTritt | 0:2254358fce87 | 12 | |
CSTritt | 0:2254358fce87 | 13 | */ |
CSTritt | 0:2254358fce87 | 14 | #include "mbed.h" |
CSTritt | 0:2254358fce87 | 15 | |
CSTritt | 3:8b392116b2f9 | 16 | DigitalIn myD2(D2, PullDown); // D2-4 and D5-7 reversed. |
CSTritt | 3:8b392116b2f9 | 17 | DigitalIn myD3(D3, PullDown); |
CSTritt | 3:8b392116b2f9 | 18 | DigitalIn myD4(D4, PullDown); |
CSTritt | 3:8b392116b2f9 | 19 | DigitalIn myD5(D5, PullUp); |
CSTritt | 3:8b392116b2f9 | 20 | DigitalIn myD6(D6, PullUp); |
CSTritt | 3:8b392116b2f9 | 21 | DigitalIn myD7(D7, PullUp); |
CSTritt | 3:8b392116b2f9 | 22 | DigitalIn myD8(D8, PullNone); |
CSTritt | 3:8b392116b2f9 | 23 | DigitalIn myD9(D9, PullNone); |
CSTritt | 3:8b392116b2f9 | 24 | DigitalIn myD10(D10, PullNone); |
CSTritt | 3:8b392116b2f9 | 25 | DigitalIn myD11(D11); |
CSTritt | 0:2254358fce87 | 26 | |
CSTritt | 0:2254358fce87 | 27 | int main() { |
CSTritt | 3:8b392116b2f9 | 28 | printf("\nPull Tests\n"); |
CSTritt | 0:2254358fce87 | 29 | |
CSTritt | 0:2254358fce87 | 30 | while(true) { |
CSTritt | 3:8b392116b2f9 | 31 | // Send D_In statuses. Casts to avoid non-POD type passed warnings. |
CSTritt | 3:8b392116b2f9 | 32 | printf("Ds = %d %d %d %d %d %d %d %d %d %d.\n", |
CSTritt | 3:8b392116b2f9 | 33 | (int) myD2, (int) myD3, (int) myD4, (int) myD5, (int) myD6, |
CSTritt | 3:8b392116b2f9 | 34 | (int) myD7, (int) myD8, (int) myD9, (int) myD10, (int) myD11); |
CSTritt | 3:8b392116b2f9 | 35 | wait(0.5); // 500 ms |
CSTritt | 0:2254358fce87 | 36 | } |
CSTritt | 0:2254358fce87 | 37 | } |