forked from platformio/platformio-core
Add Teensy HID USB mouse example
This commit is contained in:
21
examples/teensy/teensy-hid-usb-mouse/README.rst
Normal file
21
examples/teensy/teensy-hid-usb-mouse/README.rst
Normal 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
|
24
examples/teensy/teensy-hid-usb-mouse/platformio.ini
Normal file
24
examples/teensy/teensy-hid-usb-mouse/platformio.ini
Normal 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
|
24
examples/teensy/teensy-hid-usb-mouse/src/TriangleMove.ino
Normal file
24
examples/teensy/teensy-hid-usb-mouse/src/TriangleMove.ino
Normal 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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user