Add Teensy HID USB mouse example

This commit is contained in:
Ivan Kravets
2015-07-17 21:31:28 +03:00
parent 3d7c3a0c7a
commit 5d6b2e0eb6
3 changed files with 69 additions and 0 deletions

View File

@ -0,0 +1,21 @@
How to build PlatformIO based project
=====================================
1. `Install PlatformIO <http://docs.platformio.org/en/latest/installation.html>`_
2. Download `source code with examples <https://github.com/platformio/platformio/archive/develop.zip>`_
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

View File

@ -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

View File

@ -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);
}
}