You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
2.7 KiB
79 lines
2.7 KiB
/*
|
|
Blink
|
|
Turns on an LED on for one second, then off for one second, repeatedly.
|
|
Most Arduinos have an on-board LED you can control. On the Uno and
|
|
Leonardo, it is attached to digital pin 13. If you're unsure what
|
|
pin the on-board LED is connected to on your Arduino model, check
|
|
the documentation at http://arduino.cc
|
|
This example code is in the public domain.
|
|
modified 8 May 2014
|
|
by Scott Fitzgerald
|
|
|
|
Modified by Roger Clark. www.rogerclark.net for Maple mini 25th April 2015 , where the LED is on PC13
|
|
|
|
*/
|
|
|
|
/* Pro Micro Test Code
|
|
by: Nathan Seidle
|
|
modified by: Jim Lindblom
|
|
SparkFun Electronics
|
|
date: September 16, 2013
|
|
license: Public Domain - please use this code however you'd like.
|
|
It's provided as a learning tool.
|
|
This code is provided to show how to control the SparkFun
|
|
ProMicro's TX and RX LEDs within a sketch. It also serves
|
|
to explain the difference between Serial.print() and
|
|
Serial1.print().
|
|
*/
|
|
|
|
int RXLED = 17; // The RX LED has a defined Arduino pin
|
|
// Note: The TX LED was not so lucky, we'll need to use pre-defined
|
|
// macros (TXLED1, TXLED0) to control that.
|
|
// (We could use the same macros for the RX LED too -- RXLED1,
|
|
// and RXLED0.)
|
|
|
|
// the setup function runs once when you press reset or power the board
|
|
void setup() {
|
|
#if defined(ARDUINO_ARCH_STM32F0) || defined(ARDUINO_ARCH_STM32F1) || defined(ARDUINO_ARCH_STM32F3) || defined(ARDUINO_ARCH_STM32F4) || defined(ARDUINO_ARCH_STM32L4)
|
|
// initialize digital pin PB1 as an output.
|
|
pinMode(PC13, OUTPUT);
|
|
#endif
|
|
|
|
#if defined __AVR_ATmega32U4__
|
|
pinMode(RXLED, OUTPUT); // Set RX LED as an output
|
|
// TX LED is set as an output behind the scenes
|
|
#endif
|
|
|
|
Serial.begin(9600);
|
|
|
|
}
|
|
|
|
// the loop function runs over and over again forever
|
|
void loop() {
|
|
#if defined(ARDUINO_ARCH_STM32F0) || defined(ARDUINO_ARCH_STM32F1) || defined(ARDUINO_ARCH_STM32F3) || defined(ARDUINO_ARCH_STM32F4) || defined(ARDUINO_ARCH_STM32L4)
|
|
digitalWrite(PC13, LOW); // turn the LED on (HIGH is the voltage level)
|
|
#endif
|
|
|
|
#if defined __AVR_ATmega32U4__
|
|
digitalWrite(RXLED, LOW); // set the RX LED ON
|
|
TXLED0; //TX LED is not tied to a normally controlled pin so a macro is needed, turn LED OFF
|
|
#endif
|
|
|
|
Serial.println("LED is on!");
|
|
|
|
delay(1000); // wait for a second
|
|
|
|
#if defined(ARDUINO_ARCH_STM32F0) || defined(ARDUINO_ARCH_STM32F1) || defined(ARDUINO_ARCH_STM32F3) || defined(ARDUINO_ARCH_STM32F4) || defined(ARDUINO_ARCH_STM32L4)
|
|
digitalWrite(PC13, HIGH); // turn the LED off by making the voltage LOW
|
|
#endif
|
|
|
|
#if defined __AVR_ATmega32U4__
|
|
digitalWrite(RXLED, HIGH); // set the RX LED OFF
|
|
TXLED1; //TX LED macro to turn LED ON
|
|
#endif
|
|
|
|
Serial.println("LED is off!");
|
|
|
|
delay(1000); // wait for a second
|
|
}
|