diff --git a/examples/teensy/teensy-hid-usb-mouse/README.rst b/examples/teensy/teensy-hid-usb-mouse/README.rst new file mode 100644 index 00000000..e2950ca7 --- /dev/null +++ b/examples/teensy/teensy-hid-usb-mouse/README.rst @@ -0,0 +1,21 @@ +How to build PlatformIO based project +===================================== + +1. `Install PlatformIO `_ +2. Download `source code with examples `_ +3. Extract ZIP archive +4. Run these commands: + +.. code-block:: bash + + # Change directory to example + > cd platformio-develop/examples/teensy/teensy-hid-usb-mouse + + # Process example project + > platformio run + + # Upload firmware + > platformio run --target upload + + # Clean build files + > platformio run --target clean diff --git a/examples/teensy/teensy-hid-usb-mouse/platformio.ini b/examples/teensy/teensy-hid-usb-mouse/platformio.ini new file mode 100644 index 00000000..2b1c160f --- /dev/null +++ b/examples/teensy/teensy-hid-usb-mouse/platformio.ini @@ -0,0 +1,24 @@ +# +# Project Configuration File +# +# A detailed documentation with the EXAMPLES is located here: +# http://docs.platformio.org/en/latest/projectconf.html +# + +# A sign `#` at the beginning of the line indicates a comment +# Comment lines are ignored. + +# Simple and base environment +# [env:mybaseenv] +# platform = %INSTALLED_PLATFORM_NAME_HERE% +# framework = +# board = +# +# Automatic targets - enable auto-uploading +# targets = upload + +[env:teensy31] +platform = teensy +framework = arduino +board = teensy31 +build_flags = -DTEENSY31 -UUSB_SERIAL -DUSB_SERIAL_HID diff --git a/examples/teensy/teensy-hid-usb-mouse/src/TriangleMove.ino b/examples/teensy/teensy-hid-usb-mouse/src/TriangleMove.ino new file mode 100644 index 00000000..9461825c --- /dev/null +++ b/examples/teensy/teensy-hid-usb-mouse/src/TriangleMove.ino @@ -0,0 +1,24 @@ +/* Simple USB Mouse Example + Teensy becomes a USB mouse and moves the cursor in a triangle + + You must select Mouse from the "Tools > USB Type" menu + + This example code is in the public domain. +*/ + +void setup() { } // no setup needed +void loop() { + int i; + for (i=0; i<40; i++) { + Mouse.move(2, -1); + delay(25); + } + for (i=0; i<40; i++) { + Mouse.move(2, 2); + delay(25); + } + for (i=0; i<40; i++) { + Mouse.move(-4, -1); + delay(25); + } +} \ No newline at end of file