Control Arduino with Keyboard through USB cable - Yes?

I thought this would be very simple but the answers I find when searching are incredibly complicated and often involve unnecessary layers.

I want to control an LED strip in the end, but let's go simple, really really simple.

Can I use a key on my keyboard, say the 'q' key, to issue a command to the Arduino?

Lets aim to turn on the on board LED using the 'q' key on the keyboard through the USB cable - is this possible?

I don't want to muck around with extra jumpers and serial cables I just want to know if the USB cable provided (the one we regularly load sketches through) can be used for issuing commands while a sketch is running?

If you want to use a USB keyboard (which is a USB device) you will need a USB host to control that device. There is a USB host shield

If the keyboard is connected to your PC you could write a program for the PC that would send data to the Arduino when a key is pressed on the PC keyboard.

If you want to use the keyboard without the PC then @nilton61 has explained what is needed. It would probably be easier to get a keypad that can be connected directly to the Arduino. Google should find them for you.


I found a lot of the missing links here. I think over the embedded serial monitor will yield the best results for my project.

Here is a link: Arduino Code | Arduino Lesson 5. The Serial Monitor | Adafruit Learning System

I will share the code once it is refined after some sleep.

Here is the completed code.

Although it is particular to an Arduino Uno using 213 NeoPixels I am sure it will be useful.

The interface is through the serial monitor.

Look in the main tab and you can see all of the option, ‘1-9’. ‘xx’ clears all. ‘r’, ‘g’, ‘b’, sets which colors are on.

Thanks for all the help, (6.42 KB)