Difference between revisions of "Leonardo / Pro Micro"
From sudomod
(Created page with "thumb ===Description=== The cheap alternative to the Teensy LC.<br /> <br /> ===official Website=== https://www.sparkfun.com/products/126...") |
m (fixed random link to bad image.) |
||
| (7 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
[[File:Leonardo_Pro_Micro.png|right|thumb]] | [[File:Leonardo_Pro_Micro.png|right|thumb]] | ||
| − | + | ==Description== | |
The cheap alternative to the Teensy LC.<br /> | The cheap alternative to the Teensy LC.<br /> | ||
<br /> | <br /> | ||
| − | + | ||
| + | ==official Website== | ||
https://www.sparkfun.com/products/12640<br /> | https://www.sparkfun.com/products/12640<br /> | ||
<br /> | <br /> | ||
| − | === | + | ==Guide/How To== |
| + | The user IAmOrion wrote a guide on how to use the board. It can be found in the [http://sudomod.com/forum/viewtopic.php?f=8&t=612 forum]. | ||
| + | |||
| + | ===Guide for dummies=== | ||
| + | For people who are in no way experienced in programming an Arduino there's a detailed guide: | ||
| + | <ul> | ||
| + | <li>Download and install the Arduino IDE [https://www.arduino.cc/en/Main/Software from the official website]</li> | ||
| + | <li>Connect your pro micro to your PC via micro-USB cable (a red LED should light up)</li> | ||
| + | <li>Open the Arduino software, click on 'tools' and select the correct Board ("Arduino Leonardo") and Port (it should display a COM-Port with the description (Arduino Leonardo) after the Com-Port number)</li> | ||
| + | <li>Now you can Copy/Paste the following code into the provided area: | ||
| + | <syntaxhighlight> | ||
| + | #include <Keyboard.h> | ||
| + | #define BUTTONS 15 | ||
| + | int pin_arr[]={2,4,3,5,14,16,9,8,A0,A1,6,7,A2,A3,15}; | ||
| + | int keycode_arr[]={218,217,216,215,128,130,32,129,122,176,53,49,112,177,179}; | ||
| + | // UP,DOWN,LEFT,RIGHT,LEFT-CTRL (Button 1), LEFT-ALT (Button 2),SPACEBAR (Button 3), LEFT-SHIFT (Button 4), Z (Button 5), ENTER (Button 6) (Enter instead of X so can use with other RPi things like raspi-config), Coin/Credit, 1P Start, P (Pause), ESC, TAB | ||
| + | int key_state[BUTTONS]; | ||
| + | |||
| + | void setup() { | ||
| + | Keyboard.begin(); | ||
| + | for (int i=0;i<BUTTONS;i++) | ||
| + | { | ||
| + | pinMode(pin_arr[i], INPUT_PULLUP); | ||
| + | key_state[i] = digitalRead(pin_arr[i]); | ||
| + | } | ||
| + | } | ||
| + | |||
| + | void loop() { | ||
| + | for (int i=0;i<BUTTONS;i++) | ||
| + | { | ||
| + | key_state[i]=digitalRead(pin_arr[i]); | ||
| + | if (key_state[i]==LOW) { | ||
| + | Keyboard.press(keycode_arr[i]); if (keycode_arr[i] == 49) { delay(100); } | ||
| + | } else { | ||
| + | Keyboard.release(keycode_arr[i]); | ||
| + | } | ||
| + | } | ||
| + | }</syntaxhighlight></li> | ||
| + | <li>At last, check and upload the code by clicking the according buttons. After this, a green LED should light up additionally to the red one and your PC should recognize a new Keyboard device.</li> | ||
| + | <li>Done. You can test your setup now by connecting one of the Pins on the pro micro to ground and see if the according keyboard signal arrives at your PC.</li> | ||
| + | </ul> | ||
| + | |||
| + | ==Details== | ||
{| class="wikitable" style="width:25%" | {| class="wikitable" style="width:25%" | ||
! style="text-align: right; padding: 5px;" | | ! style="text-align: right; padding: 5px;" | | ||
Price | Price | ||
| ''~3€'' | | ''~3€'' | ||
| + | |- | ||
| + | ! style="text-align: right; padding: 5px;" | | ||
| + | Chip | ||
| + | | ''ATmega32u4'' | ||
|- | |- | ||
! style="text-align: right; padding: 5px;" | | ! style="text-align: right; padding: 5px;" | | ||
| Line 22: | Line 69: | ||
! style="text-align: right; padding: 5px;" | | ! style="text-align: right; padding: 5px;" | | ||
Buy it | Buy it | ||
| − | |[http://www.aliexpress.com/item/Free-Shipping-New-Pro-Micro-for-arduino-ATmega32U4-5V-16MHz-Module-with-2-row-pin-header/32269525920.html | + | |[http://www.aliexpress.com/item/Free-Shipping-New-Pro-Micro-for-arduino-ATmega32U4-5V-16MHz-Module-with-2-row-pin-header/32269525920.html aliexpress][http://www.banggood.com/Pro-Micro-Atmega32U4-5V16M-Module-Board-For-Arduino-p-985617.html banggood][https://www.amazon.com/OSOYOO-ATmega32U4-arduino-Leonardo-ATmega328/dp/B012FOV17O amazon.com][https://www.amazon.de/gp/product/B00JMOEED4/ref=oh_aui_detailpage_o02_s00?ie=UTF8&psc=1 amazon.de] |
|- | |- | ||
|} | |} | ||
Latest revision as of 22:48, 11 October 2016
Description
The cheap alternative to the Teensy LC.
official Website
https://www.sparkfun.com/products/12640
Guide/How To
The user IAmOrion wrote a guide on how to use the board. It can be found in the forum.
Guide for dummies
For people who are in no way experienced in programming an Arduino there's a detailed guide:
- Download and install the Arduino IDE from the official website
- Connect your pro micro to your PC via micro-USB cable (a red LED should light up)
- Open the Arduino software, click on 'tools' and select the correct Board ("Arduino Leonardo") and Port (it should display a COM-Port with the description (Arduino Leonardo) after the Com-Port number)
- Now you can Copy/Paste the following code into the provided area:
#include <Keyboard.h> #define BUTTONS 15 int pin_arr[]={2,4,3,5,14,16,9,8,A0,A1,6,7,A2,A3,15}; int keycode_arr[]={218,217,216,215,128,130,32,129,122,176,53,49,112,177,179}; // UP,DOWN,LEFT,RIGHT,LEFT-CTRL (Button 1), LEFT-ALT (Button 2),SPACEBAR (Button 3), LEFT-SHIFT (Button 4), Z (Button 5), ENTER (Button 6) (Enter instead of X so can use with other RPi things like raspi-config), Coin/Credit, 1P Start, P (Pause), ESC, TAB int key_state[BUTTONS]; void setup() { Keyboard.begin(); for (int i=0;i<BUTTONS;i++) { pinMode(pin_arr[i], INPUT_PULLUP); key_state[i] = digitalRead(pin_arr[i]); } } void loop() { for (int i=0;i<BUTTONS;i++) { key_state[i]=digitalRead(pin_arr[i]); if (key_state[i]==LOW) { Keyboard.press(keycode_arr[i]); if (keycode_arr[i] == 49) { delay(100); } } else { Keyboard.release(keycode_arr[i]); } } } - At last, check and upload the code by clicking the according buttons. After this, a green LED should light up additionally to the red one and your PC should recognize a new Keyboard device.
- Done. You can test your setup now by connecting one of the Pins on the pro micro to ground and see if the according keyboard signal arrives at your PC.
Details
|
Price |
~3€ |
|---|---|
|
Chip |
ATmega32u4 |
|
I/O Pins |
16 (18) |
|
Size |
~33x18mm |
|
Buy it |
aliexpressbanggoodamazon.comamazon.de |
