Arduino Pro Micro - switch off LEDs
I am using a Arduino Pro Micro as a keyboard (USB HID device). Each time I press a key, the RX LED and TX LED light up. Can I switch them off in software?
arduino-pro-micro
add a comment |
I am using a Arduino Pro Micro as a keyboard (USB HID device). Each time I press a key, the RX LED and TX LED light up. Can I switch them off in software?
arduino-pro-micro
add a comment |
I am using a Arduino Pro Micro as a keyboard (USB HID device). Each time I press a key, the RX LED and TX LED light up. Can I switch them off in software?
arduino-pro-micro
I am using a Arduino Pro Micro as a keyboard (USB HID device). Each time I press a key, the RX LED and TX LED light up. Can I switch them off in software?
arduino-pro-micro
arduino-pro-micro
asked Apr 13 at 12:59
qubitqubit
7815
7815
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Kind of.
You would need to edit the pins_arduino.h
file for the Pro Micro board to change the definitions of the TXLED0
, TXLED1
, RXLED0
, RXLED1
and TX_RX_LED_INIT
macros.
You want them to all be defined, but empty.
#undef TXLED0
#undef TXLED1
#undef RXLED0
#undef RXLED1
#undef TX_RX_LED_INIT
#define TXLED0
#define TXLED1
#define RXLED0
#define RXLED1
#define TX_RX_LED_INIT
That will remove the current definitions, and then create new empty definitions. Without the empty definitions, you will get errors when compiling.
add a comment |
Kind of.
You don't have to change pins_arduino.h
.
Try the LED_BUILTIN_TX
and the LED_BUILTIN_RX
.
The pins are turned on and off by the code for the SerialUSB port. That can not be changed without changing the Arduino libraries. Setting that pin to INPUT in your sketch in the setup() function will turn them off:
pinMode(LED_BUILTIN_TX,INPUT);
pinMode(LED_BUILTIN_RX,INPUT);
If you have troubles with the LED_BUILTIN_TX
and the LED_BUILTIN_RX
, then you can use this as well:
bitClear(DDRD,5);
bitClear(DDRB,0);
The code for the SerialUSB port still writes to that pin, but once they are set as INPUT, that code will turn on and off the pullup resistor. That is no problem since those leds are connected to VCC.
To turn them on is also possible, but then those pins needs to be OUTPUT and LOW. They will not stay on when the SerialUSB port is used.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("schematics", function () {
StackExchange.schematics.init();
});
}, "cicuitlab");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "540"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2farduino.stackexchange.com%2fquestions%2f63446%2farduino-pro-micro-switch-off-leds%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Kind of.
You would need to edit the pins_arduino.h
file for the Pro Micro board to change the definitions of the TXLED0
, TXLED1
, RXLED0
, RXLED1
and TX_RX_LED_INIT
macros.
You want them to all be defined, but empty.
#undef TXLED0
#undef TXLED1
#undef RXLED0
#undef RXLED1
#undef TX_RX_LED_INIT
#define TXLED0
#define TXLED1
#define RXLED0
#define RXLED1
#define TX_RX_LED_INIT
That will remove the current definitions, and then create new empty definitions. Without the empty definitions, you will get errors when compiling.
add a comment |
Kind of.
You would need to edit the pins_arduino.h
file for the Pro Micro board to change the definitions of the TXLED0
, TXLED1
, RXLED0
, RXLED1
and TX_RX_LED_INIT
macros.
You want them to all be defined, but empty.
#undef TXLED0
#undef TXLED1
#undef RXLED0
#undef RXLED1
#undef TX_RX_LED_INIT
#define TXLED0
#define TXLED1
#define RXLED0
#define RXLED1
#define TX_RX_LED_INIT
That will remove the current definitions, and then create new empty definitions. Without the empty definitions, you will get errors when compiling.
add a comment |
Kind of.
You would need to edit the pins_arduino.h
file for the Pro Micro board to change the definitions of the TXLED0
, TXLED1
, RXLED0
, RXLED1
and TX_RX_LED_INIT
macros.
You want them to all be defined, but empty.
#undef TXLED0
#undef TXLED1
#undef RXLED0
#undef RXLED1
#undef TX_RX_LED_INIT
#define TXLED0
#define TXLED1
#define RXLED0
#define RXLED1
#define TX_RX_LED_INIT
That will remove the current definitions, and then create new empty definitions. Without the empty definitions, you will get errors when compiling.
Kind of.
You would need to edit the pins_arduino.h
file for the Pro Micro board to change the definitions of the TXLED0
, TXLED1
, RXLED0
, RXLED1
and TX_RX_LED_INIT
macros.
You want them to all be defined, but empty.
#undef TXLED0
#undef TXLED1
#undef RXLED0
#undef RXLED1
#undef TX_RX_LED_INIT
#define TXLED0
#define TXLED1
#define RXLED0
#define RXLED1
#define TX_RX_LED_INIT
That will remove the current definitions, and then create new empty definitions. Without the empty definitions, you will get errors when compiling.
answered Apr 13 at 13:08
Majenko♦Majenko
69.8k43379
69.8k43379
add a comment |
add a comment |
Kind of.
You don't have to change pins_arduino.h
.
Try the LED_BUILTIN_TX
and the LED_BUILTIN_RX
.
The pins are turned on and off by the code for the SerialUSB port. That can not be changed without changing the Arduino libraries. Setting that pin to INPUT in your sketch in the setup() function will turn them off:
pinMode(LED_BUILTIN_TX,INPUT);
pinMode(LED_BUILTIN_RX,INPUT);
If you have troubles with the LED_BUILTIN_TX
and the LED_BUILTIN_RX
, then you can use this as well:
bitClear(DDRD,5);
bitClear(DDRB,0);
The code for the SerialUSB port still writes to that pin, but once they are set as INPUT, that code will turn on and off the pullup resistor. That is no problem since those leds are connected to VCC.
To turn them on is also possible, but then those pins needs to be OUTPUT and LOW. They will not stay on when the SerialUSB port is used.
add a comment |
Kind of.
You don't have to change pins_arduino.h
.
Try the LED_BUILTIN_TX
and the LED_BUILTIN_RX
.
The pins are turned on and off by the code for the SerialUSB port. That can not be changed without changing the Arduino libraries. Setting that pin to INPUT in your sketch in the setup() function will turn them off:
pinMode(LED_BUILTIN_TX,INPUT);
pinMode(LED_BUILTIN_RX,INPUT);
If you have troubles with the LED_BUILTIN_TX
and the LED_BUILTIN_RX
, then you can use this as well:
bitClear(DDRD,5);
bitClear(DDRB,0);
The code for the SerialUSB port still writes to that pin, but once they are set as INPUT, that code will turn on and off the pullup resistor. That is no problem since those leds are connected to VCC.
To turn them on is also possible, but then those pins needs to be OUTPUT and LOW. They will not stay on when the SerialUSB port is used.
add a comment |
Kind of.
You don't have to change pins_arduino.h
.
Try the LED_BUILTIN_TX
and the LED_BUILTIN_RX
.
The pins are turned on and off by the code for the SerialUSB port. That can not be changed without changing the Arduino libraries. Setting that pin to INPUT in your sketch in the setup() function will turn them off:
pinMode(LED_BUILTIN_TX,INPUT);
pinMode(LED_BUILTIN_RX,INPUT);
If you have troubles with the LED_BUILTIN_TX
and the LED_BUILTIN_RX
, then you can use this as well:
bitClear(DDRD,5);
bitClear(DDRB,0);
The code for the SerialUSB port still writes to that pin, but once they are set as INPUT, that code will turn on and off the pullup resistor. That is no problem since those leds are connected to VCC.
To turn them on is also possible, but then those pins needs to be OUTPUT and LOW. They will not stay on when the SerialUSB port is used.
Kind of.
You don't have to change pins_arduino.h
.
Try the LED_BUILTIN_TX
and the LED_BUILTIN_RX
.
The pins are turned on and off by the code for the SerialUSB port. That can not be changed without changing the Arduino libraries. Setting that pin to INPUT in your sketch in the setup() function will turn them off:
pinMode(LED_BUILTIN_TX,INPUT);
pinMode(LED_BUILTIN_RX,INPUT);
If you have troubles with the LED_BUILTIN_TX
and the LED_BUILTIN_RX
, then you can use this as well:
bitClear(DDRD,5);
bitClear(DDRB,0);
The code for the SerialUSB port still writes to that pin, but once they are set as INPUT, that code will turn on and off the pullup resistor. That is no problem since those leds are connected to VCC.
To turn them on is also possible, but then those pins needs to be OUTPUT and LOW. They will not stay on when the SerialUSB port is used.
edited Apr 13 at 21:37
answered Apr 13 at 14:15
JotJot
2,8651618
2,8651618
add a comment |
add a comment |
Thanks for contributing an answer to Arduino Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2farduino.stackexchange.com%2fquestions%2f63446%2farduino-pro-micro-switch-off-leds%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown