Open the Arduino IDE.
Tools > Port
Select the communications port for your Pro Micro. If you have more than one listed, note the port names, unplug the Pro Micro USB cable, Tools > Port. The that is missing is (was) your Pro Micro. Plug the USB cable in again and select the port.
Tools > Board > SparkFun AVR Boards > SparkFun Pro Micro
Important! Don't forget this step or your Pro Micro wil be "bricked!"
Tools > Processor: ATMega32U5 (5V, 16Mhz)
Be sure to select the 5V Processor!
File > New
Select all of the code and delete it.
Copy/paste this code:
/*
Blink
Turns an LED on for one second, then off for one second, repeatedly.
http://www.arduino.cc/en/Tutorial/Blink
+ mods by Wayne Seltzer
Board: Sparkfun AVR boards ... Sparkfun Pro Micro
IMPORTANT!
Processor: Select the correct board voltage (5 volt or 3.3 volt)
*/
int LED_BLUE_PIN = 14; // External LED pin, active HIGH
int RX_LED_PIN = 17; // RX_LED on the Pro Micro board, active LOW
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pins as an output.
pinMode(LED_BLUE_PIN, OUTPUT);
pinMode(RX_LED_PIN, OUTPUT);
// initialize the serial port
Serial.begin(9600); // Use the Arduino IDE "Serial Monitor" - be sure to match the baud rate setting!
}
// the loop function runs over and over again forever
void loop() {
Serial.println("ON");
digitalWrite(LED_BLUE_PIN, HIGH); // turn the External LED on (connected as active HIGH)
digitalWrite(RX_LED_PIN, LOW); // turn the RX_LED on (connected as active LOW)
delay(1000); // wait for a second (1000 milliseconds)
Serial.println("off");
digitalWrite(LED_BLUE_PIN, LOW); // turn the External LED off
digitalWrite(RX_LED_PIN, HIGH); // turn the LED off
delay(1000);
}
Sketch > Upload
Wait for the sketch to compile and run. You LED should be blinking!
Tools > Serial Monitor
You should be seeing the ON off debugging output text.
(If you are seeing garbage characters, check that the Serial Monitor baud rate is set to 9600 (on the right side of the screen.)
Experiment!
Change the blinking rate by changing the delay( ) statements.
Flash "SOS" (copy/paste the on/off sections of the sketch and change the timings.
You can use for ( ) to do things multiple times:
https://www.arduino.cc/reference/en/language/structure/control-structure/for/
for (int i = 0; i <= 255; i++) {
// blink the LED
}
Your ideas?