Arduino Pro Micro - switch off LEDs












4















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?










share|improve this question



























    4















    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?










    share|improve this question

























      4












      4








      4








      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?










      share|improve this question














      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Apr 13 at 12:59









      qubitqubit

      7815




      7815






















          2 Answers
          2






          active

          oldest

          votes


















          2














          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.






          share|improve this answer































            3














            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.






            share|improve this answer


























              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
              });


              }
              });














              draft saved

              draft discarded


















              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









              2














              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.






              share|improve this answer




























                2














                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.






                share|improve this answer


























                  2












                  2








                  2







                  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.






                  share|improve this answer













                  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.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Apr 13 at 13:08









                  MajenkoMajenko

                  69.8k43379




                  69.8k43379























                      3














                      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.






                      share|improve this answer






























                        3














                        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.






                        share|improve this answer




























                          3












                          3








                          3







                          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.






                          share|improve this answer















                          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.







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Apr 13 at 21:37

























                          answered Apr 13 at 14:15









                          JotJot

                          2,8651618




                          2,8651618






























                              draft saved

                              draft discarded




















































                              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.




                              draft saved


                              draft discarded














                              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





















































                              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







                              Popular posts from this blog

                              Plaza Victoria

                              Puebla de Zaragoza

                              Musa