Proyecto de Tesis en Mecatrónica. Universidad Técnica del Norte. Ernesto Palacios <mecatronica.mid@gmail.com>
Dependencies: EthernetNetIf HTTPServer QEI_hw RPCInterface mbed
main.cpp@0:8c5c37feacb8, 2012-02-07 (annotated)
- Committer:
- Yo_Robot
- Date:
- Tue Feb 07 03:16:33 2012 +0000
- Revision:
- 0:8c5c37feacb8
- Child:
- 1:186187f69295
PTO using PWM, still needs some work;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Yo_Robot | 0:8c5c37feacb8 | 1 | #include "mbed.h" |
Yo_Robot | 0:8c5c37feacb8 | 2 | |
Yo_Robot | 0:8c5c37feacb8 | 3 | Serial pc ( USBTX, USBRX ); |
Yo_Robot | 0:8c5c37feacb8 | 4 | DigitalOut enable( p7 ); |
Yo_Robot | 0:8c5c37feacb8 | 5 | PwmOut driver( p21); |
Yo_Robot | 0:8c5c37feacb8 | 6 | |
Yo_Robot | 0:8c5c37feacb8 | 7 | void ISR_Serial() |
Yo_Robot | 0:8c5c37feacb8 | 8 | { |
Yo_Robot | 0:8c5c37feacb8 | 9 | float t; |
Yo_Robot | 0:8c5c37feacb8 | 10 | pc.scanf( "%f", &t ); |
Yo_Robot | 0:8c5c37feacb8 | 11 | driver.period( t); |
Yo_Robot | 0:8c5c37feacb8 | 12 | } |
Yo_Robot | 0:8c5c37feacb8 | 13 | |
Yo_Robot | 0:8c5c37feacb8 | 14 | int main() |
Yo_Robot | 0:8c5c37feacb8 | 15 | { |
Yo_Robot | 0:8c5c37feacb8 | 16 | driver = 0.50; //50% duty always for driver |
Yo_Robot | 0:8c5c37feacb8 | 17 | enable = 1; |
Yo_Robot | 0:8c5c37feacb8 | 18 | driver.period(0.5); |
Yo_Robot | 0:8c5c37feacb8 | 19 | |
Yo_Robot | 0:8c5c37feacb8 | 20 | pc.attach( &ISR_Serial ); |
Yo_Robot | 0:8c5c37feacb8 | 21 | |
Yo_Robot | 0:8c5c37feacb8 | 22 | while(1) |
Yo_Robot | 0:8c5c37feacb8 | 23 | { |
Yo_Robot | 0:8c5c37feacb8 | 24 | |
Yo_Robot | 0:8c5c37feacb8 | 25 | |
Yo_Robot | 0:8c5c37feacb8 | 26 | } |
Yo_Robot | 0:8c5c37feacb8 | 27 | |
Yo_Robot | 0:8c5c37feacb8 | 28 | } |