sparkfun DEV-11520 Hook-Up Manual Download Page 17

With the code uploaded you should see the RX and TX LEDs take turns 
blinking on and off every second. You can also open up the serial monitor 
(set to 9600 bps) and see every programmer’s favorite two-word phrase.

Understanding the Sketch

The RX LED is tied to Arduino’s pin 17. You can control it just as you would 
any other digital pin. Set it as an 

OUTPUT

, and 

digitalWrite([pin],

 

[level])

it 

HIGH

or 

LOW

. The TX LED was not 

provided as an Arduino-defined pin, unfortunately, so you’ll have to use a 
pair of macros to control it. 

TXLED1

turns the LED on, and 

TXLED0

turns 

the LED off.

In that sketch, you’ll also notice a pair of 

Serial

initialization statements: 

Serial.begin(9600)

Serial1.begin(9600)

. That ‘1’ makes a huge 

difference. Think of the Pro Micro having two separate serial ports. The one 

without

the ‘1’ is for communication to and from the computer over USB; 

this is what is visible in the Serial Monitor. The 

Serial1

port is a bonafide, 

hardware UART

, where your Pro Micro can talk to any serial-enabled piece 

of hardware.

If you open up the 

Serial Monitor

, you should only see ‘Hello world’ 

printed. ‘Hello!’ is being sent out over the hardware UART, where, 
presumably, nothing is listening. This begs the age-old question: “if a Pro 
Micro is saying ‘Hello!’ over the hardware serial port, and nothing is there to 
hear it, does the Pro Micro really say anything at all?.”

Why Does My Board Re-Enumerate Every 

Upload?

In order to communicate serially, the Pro Micro emulates a 

virtual serial 

port

. Actually, it emulates two different serial ports – one for the bootloader, 

and one for the sketch. Since the bootloader and sketch run individually. 
Only one of these serial ports is visible at any one time.

When you click ‘Upload’ in the Arduino IDE, the Pro Micro resets itself and 
starts its 

bootloader

program. (The bootloader is a low-level program on 

the Pro Micro which enables self-programming via serial.) To our operating 
system, the bootloader looks like a completely different device, so it gets its 
own serial port number. While the Pro Micro is being programmed, the 
bootloader serial port will be open. When the sketch upload is finished, the 
bootloader will exit, that serial port will be closed, and the regular Pro Micro 
serial port will open up.

What this all boils down to is the fact that you have to 

be patient

with Pro 

Micros. Every time you upload a new sketch, your OS will need to work its 
driver magic before you can open up the COM port. This can take a few 
seconds after the code has finished uploading.

Page 17 of 27

Summary of Contents for DEV-11520

Page 1: ...acting as an intermediary between your Arduino and your computer The SparkFun Pro Micro is a really cool little development board It s an Arduino compatible microcontroller micro sized and it accompl...

Page 2: ...d Arduino addon on Mac Example 1 Blinkies A simple Hello world sketch specifically suited to the Pro Micro and Fio v3 Example 2 HID Mouse and Keyboard An introduction to the HID USB capability of the...

Page 3: ...tage at this pin will be about 4 8V USB s 5V minus a schottkey diode drop On the other hand if the board is powered externally through this pin the applied voltage can be up to 12V VCC is the voltage...

Page 4: ...nterrupts which allow you to instantly trigger a function when a pin goes either high or low or both If you attach an interrupt to an interrupt enabled pin you ll need to know the specific interrupt t...

Page 5: ...e USB cable can be connected to either a computer USB hub or a USB wall adapter which can in most cases provide more power Alternatively if your Pro Micro is living out in the wild out of reach of USB...

Page 6: ...Fio v3 is what makes it unique a footprint for an XBee on the bottom and a LiPo charging circuit on the top The Pinout All of the Fio v3 s pins are broken out to either side of the board Some pins are...

Page 7: ...can be used to interface with digital devices like serial LCDs IMUs and other serial sensors The Fio v3 has five external interrupts which allow you to instantly trigger a function when a pin goes ei...

Page 8: ...the LiPo Charger The Fio v3 has a LiPo charge management circuit based around the MCP73831 built onto it which handles the signal conditioning required to safely charge a single cell LiPo battery To u...

Page 9: ...n install these drivers you ll need to disable driver signature enforcement Please check out our quick Disabling Driver Signature Enforcement tutorial for help with that Step 1 Download the Driver Bef...

Page 10: ...all the driver is through the Device Manager To get to the Device Manager click the Start button then open the Control Panel In the Control Panel click System and Maintenance and then open the Device...

Page 11: ...r folder click OK then select Next Windows will attempt to do its driver install thing but not before complaining about the driver being unsigned It s safe to select Install this driver software anywa...

Page 12: ...y work with Arduino 1 5 and up If you re using an earlier version of Arduino either update and get some cool new features or download the older version of the Addon Where s your Arduino sketchbook Wel...

Page 13: ...board you have Check the bottom of the board where you should find either a 5V or 3 3V box checked You should also see your Pro Micro s COM port under the Tools Serial Port menu Select it and head ov...

Page 14: ...ures or download the older version of the Addon With that downloaded follow these steps to enable the Pro Micro in your Arduino environment 1 The addon files are supplied in a zip folder so you ll nee...

Page 15: ...etch Example 1 Blinkies The Arduino standard Blink sketch won t have any visible effect on the Pro Micro there s no LED on pin 13 In fact the only LEDs on the board are the power indicator and RX TX b...

Page 16: ...e defined macros TXLED1 TXLED0 to control that We could use the same macros for the RX LED too RXLED1 and RXLED0 void setup pinMode RXLED OUTPUT Set RX LED as an output TX LED is set as an output behi...

Page 17: ...mably nothing is listening This begs the age old question if a Pro Micro is saying Hello over the hardware serial port and nothing is there to hear it does the Pro Micro really say anything at all Why...

Page 18: ...a class which defines what its general purpose is There are loads of classes printers hubs speakers and webcams to mention a few but in this example we ll be emulating HID Human Interface Device The...

Page 19: ...0 delay so there aren t a kajillion z s In this sketch connecting pin 9 to ground will make the Pro Micro spit out a z character If you have a simple momentary button handy tie one end to pin 9 and th...

Page 20: ...gle byte each bit of which represents a different button You can set it equal to any of the following or OR them together to click multiple buttons at once MOUSE_LEFT Left Mouse button MOUSE_RIGHT Rig...

Page 21: ...joystick int vertZero horzZero Stores the initial value of each a xis usually around 512 int vertValue horzValue Stores current analog output of each axis const int sensitivity 200 Higher sensitivity...

Page 22: ...ck and sends the Mouse move command based on what it reads It ll move the mouse in steps depending on what the sensitivity variable is set to With sensitivity set to 2 the cursor will move in either 1...

Page 23: ...rduino back up check the Serial Ports menu again Reset to Bootloader We ship the Pro Micro with a modified version of the Arduino Leonardo bootloader with one major enhancement When a Leonardo or any...

Page 24: ...rly unusable It s not uncommon for Pro Micro s to become bricked and unprogrammable But in most cases the bricking is reversible The most common source of Pro Micro bricking is uploading code to it wi...

Page 25: ...to compile first it may help to hit upload first and then reset Frequently Asked Questions If you re having technical difficulties with your Pro Micro or Fio v3 see if any of the answers to these FAQs...

Page 26: ...gs to work on this chip How Do I Reinstall the Bootloader Check out or reinstalling the bootloader tutorial which should work for both ATMega32U4 and ATMega328 boards If you have the tools to do so re...

Page 27: ...Arduino Comparison Guide Connecting Arduino to Processing Using the Arduino Pro Mini 3 3V Page 27 of 27 2 12 2015 https learn sparkfun com tutorials pro micro fio v3 hookup guide...

Reviews: