![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
H-brug test op cny70
Dependencies: HC_SR04_Ultrasonic_Library Servo mbed
main.cpp@0:aa2655f3bcb1, 2017-05-24 (annotated)
- Committer:
- Markoenema
- Date:
- Wed May 24 19:02:11 2017 +0000
- Revision:
- 0:aa2655f3bcb1
CNY70+Motor
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Markoenema | 0:aa2655f3bcb1 | 1 | #include "mbed.h" |
Markoenema | 0:aa2655f3bcb1 | 2 | DigitalOut pin1(D11); |
Markoenema | 0:aa2655f3bcb1 | 3 | DigitalOut pin2(D12); |
Markoenema | 0:aa2655f3bcb1 | 4 | |
Markoenema | 0:aa2655f3bcb1 | 5 | float p; |
Markoenema | 0:aa2655f3bcb1 | 6 | |
Markoenema | 0:aa2655f3bcb1 | 7 | int main() { |
Markoenema | 0:aa2655f3bcb1 | 8 | while(1){ |
Markoenema | 0:aa2655f3bcb1 | 9 | |
Markoenema | 0:aa2655f3bcb1 | 10 | pin1=1; |
Markoenema | 0:aa2655f3bcb1 | 11 | pin2=0; |
Markoenema | 0:aa2655f3bcb1 | 12 | printf("Pin1: %d\n", pin1); |
Markoenema | 0:aa2655f3bcb1 | 13 | printf("Pin2: %d\n", pin2); |
Markoenema | 0:aa2655f3bcb1 | 14 | wait(5); |
Markoenema | 0:aa2655f3bcb1 | 15 | pin1=1; |
Markoenema | 0:aa2655f3bcb1 | 16 | pin2=1; |
Markoenema | 0:aa2655f3bcb1 | 17 | printf("Pin1: %d\n", pin1); |
Markoenema | 0:aa2655f3bcb1 | 18 | printf("Pin2: %d\n", pin2); |
Markoenema | 0:aa2655f3bcb1 | 19 | wait(5); |
Markoenema | 0:aa2655f3bcb1 | 20 | pin1=0; |
Markoenema | 0:aa2655f3bcb1 | 21 | pin2=1; |
Markoenema | 0:aa2655f3bcb1 | 22 | printf("Pin1: %d\n", pin1); |
Markoenema | 0:aa2655f3bcb1 | 23 | printf("Pin2: %d\n", pin2); |
Markoenema | 0:aa2655f3bcb1 | 24 | wait(5); |
Markoenema | 0:aa2655f3bcb1 | 25 | |
Markoenema | 0:aa2655f3bcb1 | 26 | } |
Markoenema | 0:aa2655f3bcb1 | 27 | |
Markoenema | 0:aa2655f3bcb1 | 28 | |
Markoenema | 0:aa2655f3bcb1 | 29 | |
Markoenema | 0:aa2655f3bcb1 | 30 | } |