Dependencies:   mbed lwip

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "DemoBoard.h"
00002 
00003 /*
00004  * This project uses the USB interface configured as a mouse, using the HID device class
00005  * Thw X,Y pots give the mouse control, and the buttons are the mouse buttons
00006  */
00007 
00008 int main() {
00009 
00010     while(1) {
00011     
00012         // read the pots, use them to offset and scale the X,Y values
00013         float mx = ((potx.read()-0.50f) * 100.0f);
00014         float my = ((poty.read()-0.54f) * 130.0f);
00015         
00016         // Call the mouse function with the X,Y and button status        
00017         hid.mouse(mx, -my, RedButton.read());        
00018     }
00019 
00020 }
00021 
00022