![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Hall Sensor PCB mounting
main.cpp@0:f8b3b7c6c71b, 2017-03-09 (annotated)
- Committer:
- oguro
- Date:
- Thu Mar 09 01:28:47 2017 +0000
- Revision:
- 0:f8b3b7c6c71b
- Child:
- 1:5636e2520744
Hall Sensor Timing
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
oguro | 0:f8b3b7c6c71b | 1 | #include "mbed.h" |
oguro | 0:f8b3b7c6c71b | 2 | |
oguro | 0:f8b3b7c6c71b | 3 | DigitalOut myled(LED1); |
oguro | 0:f8b3b7c6c71b | 4 | Serial pc(USBTX,USBRX); |
oguro | 0:f8b3b7c6c71b | 5 | |
oguro | 0:f8b3b7c6c71b | 6 | |
oguro | 0:f8b3b7c6c71b | 7 | DigitalIn H1(PA_15); |
oguro | 0:f8b3b7c6c71b | 8 | DigitalIn H2(PB_3); |
oguro | 0:f8b3b7c6c71b | 9 | DigitalIn H3(PB_10); |
oguro | 0:f8b3b7c6c71b | 10 | |
oguro | 0:f8b3b7c6c71b | 11 | AnalogOut Hout(PA_4); |
oguro | 0:f8b3b7c6c71b | 12 | |
oguro | 0:f8b3b7c6c71b | 13 | int main() { |
oguro | 0:f8b3b7c6c71b | 14 | pc.baud(128000); |
oguro | 0:f8b3b7c6c71b | 15 | |
oguro | 0:f8b3b7c6c71b | 16 | while(1) { |
oguro | 0:f8b3b7c6c71b | 17 | myled = !myled; |
oguro | 0:f8b3b7c6c71b | 18 | |
oguro | 0:f8b3b7c6c71b | 19 | U=H1; V=H2; W=H3; |
oguro | 0:f8b3b7c6c71b | 20 | |
oguro | 0:f8b3b7c6c71b | 21 | pc.printf("%d,%d,%d \r" ,U,V,W); |
oguro | 0:f8b3b7c6c71b | 22 | |
oguro | 0:f8b3b7c6c71b | 23 | } |
oguro | 0:f8b3b7c6c71b | 24 | } |