Program to test the quadrature encoders on the mbed WSE single board computer.
This program uses the mbed WSE project SBC to read from both encoder channels and transmit the program run time and encoder count position to a PC through the virtual com port (USB).
Diff: main.cpp
- Revision:
- 0:0e1fba1db6a4
- Child:
- 1:dc6b98039052
diff -r 000000000000 -r 0e1fba1db6a4 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Sep 25 13:54:36 2014 +0000 @@ -0,0 +1,23 @@ +// Test program for WSE-PROJ-SBC +// J Bradshaw +// 20140918 +#include "mbed.h" +#include "mbedWSEsbc.h" + +//------------------- MAIN -------------------------------- +int main() +{ + long enc1, enc2; + + mbedWSEsbcInit(9600); //Initialize the mbed WSE Project SBC + + pc.printf("Encoder Test\r\n"); + t.reset(); // zero timer + while(1){ + enc1 = LS7366_read_counter(1); + enc2 = LS7366_read_counter(2); + pc.printf("T=%.2f Enc1=%d Enc2=%d \r", t.read(), enc1, enc2); + led3=!led3; + wait(.02); + }//while(1) +}//main