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).
main.cpp
- Committer:
- jebradshaw
- Date:
- 2014-10-16
- Revision:
- 1:dc6b98039052
- Parent:
- 0:0e1fba1db6a4
File content as of revision 1:dc6b98039052:
// Test program for WSE-PROJ-SBC // J Bradshaw // 20140918 #include "mbed.h" #include "mbedWSEsbc.h" //------------------- MAIN -------------------------------- int main() { long enc1, enc2 = 0; 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