Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "mbed.h"
- #include "USBMouse.h"
- //create mouse object
- USBMouse mouse;
- int main()
- {
- int16_t x = 0;
- int16_t y = 0;
- double radius = 20;
- int32_t angle = 0;
- while (1) {
- //will cause mouse to move in a circle
- x = cos((double)angle * 3.14 / 180.0) * (int32_t)radius;
- y = sin((double)angle * 3.14 / 180.0) * (int32_t)radius;
- //will move mouse x, y away from its previous position on the screen
- mouse.move(x, y);
- angle += 3;
- ThisThread::sleep_for(10);
- radius *= 0.9995;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement