From 15ce8137b92f5b0cdb3c6e5ac51f02e52eb2c7a4 Mon Sep 17 00:00:00 2001 From: "aka. N[]NE in gaming communities" Date: Mon, 6 Nov 2017 08:55:32 -0500 Subject: [PATCH 1/3] Update BlinkNcount.ino Uses `#define` for LED pin instead of 5 literals --- .../General/BlinkNcount/BlinkNcount.ino | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/STM32F1/libraries/A_STM32_Examples/examples/General/BlinkNcount/BlinkNcount.ino b/STM32F1/libraries/A_STM32_Examples/examples/General/BlinkNcount/BlinkNcount.ino index 1b1f58a..b05ece9 100644 --- a/STM32F1/libraries/A_STM32_Examples/examples/General/BlinkNcount/BlinkNcount.ino +++ b/STM32F1/libraries/A_STM32_Examples/examples/General/BlinkNcount/BlinkNcount.ino @@ -1,35 +1,38 @@ /* - BlinkNcount for Maple Mini by m. ray burnette + BlinkNcount for Maple Mini by m. ray burnette, update by The Lightning Stalker to use #define Sketch uses 13,808 bytes (12%) of program storage space. Maximum is 108,000 bytes. Global variables use 2,592 bytes of dynamic memory. Turns on an LED on for one second, then off for one second, repeatedly. Counts and displays the count on the attached serial monitor This example code is in the public domain. - */ +*/ + +#define LED_PIN PB1 // Maple Mini LED is on PB1, other boards may vary + int n = 0; -void setup() { +void setup() { // initialize the digital pin as an output. - pinMode(33, OUTPUT); + pinMode(LED_PIN, OUTPUT); // Initialize virtual COM over USB on Maple Mini Serial.begin(9600); // BAUD has no effect on USB serial: placeholder for physical UART // wait for serial monitor to be connected. while (!Serial) { - digitalWrite(33,!digitalRead(33));// Turn the LED from off to on, or on to off + digitalWrite(LED_PIN, !digitalRead(LED_PIN)); // Turn the LED from off to on, or on to off delay(100); // fast blink } Serial.println("Blink LED & count Demo"); } void loop() { - digitalWrite(33, HIGH); // set the LED on + digitalWrite(LED_PIN, HIGH); // set the LED on delay(500); // wait for a second - digitalWrite(33, LOW); // set the LED off + digitalWrite(LED_PIN, LOW); // set the LED off Serial.print("Loop #: "); n++; Serial.println(n); - - delay(500); // wait + + delay(500); // wait } From 15d12bee18188a4276b83272bb6545713a3fc697 Mon Sep 17 00:00:00 2001 From: "aka. N[]NE in gaming communities" Date: Mon, 6 Nov 2017 19:00:41 -0500 Subject: [PATCH 2/3] Update BlinkNcount.c Changed pin to PC13 --- .../examples/General/BlinkNcount/BlinkNcount.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/STM32F1/libraries/A_STM32_Examples/examples/General/BlinkNcount/BlinkNcount.ino b/STM32F1/libraries/A_STM32_Examples/examples/General/BlinkNcount/BlinkNcount.ino index b05ece9..60a4c17 100644 --- a/STM32F1/libraries/A_STM32_Examples/examples/General/BlinkNcount/BlinkNcount.ino +++ b/STM32F1/libraries/A_STM32_Examples/examples/General/BlinkNcount/BlinkNcount.ino @@ -7,7 +7,7 @@ This example code is in the public domain. */ -#define LED_PIN PB1 // Maple Mini LED is on PB1, other boards may vary +#define LED_PIN PC13 // Maple Mini LED is on PB1, other boards may vary int n = 0; From fd00f020722d7f8e69a974d28f4b9de4c5d62fe4 Mon Sep 17 00:00:00 2001 From: LightningStalker Date: Fri, 10 Nov 2017 04:10:31 -0500 Subject: [PATCH 3/3] Update BlinkNcount.ino to use LED_BUILTIN --- .../examples/General/BlinkNcount/BlinkNcount.ino | 15 ++++++--------- STM32F1/variants/generic_stm32f103c/variant.h | 2 +- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/STM32F1/libraries/A_STM32_Examples/examples/General/BlinkNcount/BlinkNcount.ino b/STM32F1/libraries/A_STM32_Examples/examples/General/BlinkNcount/BlinkNcount.ino index 60a4c17..11f88f8 100644 --- a/STM32F1/libraries/A_STM32_Examples/examples/General/BlinkNcount/BlinkNcount.ino +++ b/STM32F1/libraries/A_STM32_Examples/examples/General/BlinkNcount/BlinkNcount.ino @@ -1,35 +1,32 @@ /* - BlinkNcount for Maple Mini by m. ray burnette, update by The Lightning Stalker to use #define + BlinkNcount for Maple Mini by m. ray burnette Sketch uses 13,808 bytes (12%) of program storage space. Maximum is 108,000 bytes. Global variables use 2,592 bytes of dynamic memory. Turns on an LED on for one second, then off for one second, repeatedly. Counts and displays the count on the attached serial monitor This example code is in the public domain. -*/ - -#define LED_PIN PC13 // Maple Mini LED is on PB1, other boards may vary - + */ int n = 0; void setup() { // initialize the digital pin as an output. - pinMode(LED_PIN, OUTPUT); + pinMode(LED_BUILTIN, OUTPUT); // Initialize virtual COM over USB on Maple Mini Serial.begin(9600); // BAUD has no effect on USB serial: placeholder for physical UART // wait for serial monitor to be connected. while (!Serial) { - digitalWrite(LED_PIN, !digitalRead(LED_PIN)); // Turn the LED from off to on, or on to off + digitalWrite(LED_BUILTIN,!digitalRead(LED_BUILTIN)); // Turn the LED from off to on, or on to off delay(100); // fast blink } Serial.println("Blink LED & count Demo"); } void loop() { - digitalWrite(LED_PIN, HIGH); // set the LED on + digitalWrite(LED_BUILTIN, HIGH); // set the LED on delay(500); // wait for a second - digitalWrite(LED_PIN, LOW); // set the LED off + digitalWrite(LED_BUILTIN, LOW); // set the LED off Serial.print("Loop #: "); n++; Serial.println(n); diff --git a/STM32F1/variants/generic_stm32f103c/variant.h b/STM32F1/variants/generic_stm32f103c/variant.h index 4a9cfcd..dc4b894 100644 --- a/STM32F1/variants/generic_stm32f103c/variant.h +++ b/STM32F1/variants/generic_stm32f103c/variant.h @@ -19,4 +19,4 @@ static const uint8_t SCK = BOARD_SPI1_SCK_PIN; #define LED_BUILTIN PC13 -#endif /* _VARIANT_ARDUINO_STM32_ */ \ No newline at end of file +#endif /* _VARIANT_ARDUINO_STM32_ */