Sending a command from PC to Arduino

My apologies if what I’m asking here is clearly spelled out somewhere else I have yet to find. I’m new to Arduino and would love some direction if anyone had a few moments.

I’ve got a good walk through on how to move a stepper motor with Arduino so I’m set to go there but where I need a little help is sending a command from PC through USB to arduino to do one of two things; Function Clockwise or Function Counter-Clockwise. Each function would step my motor the same amount of times but one has the direction of right and the other left.

I would like to run something on a PC (Batch script, WMI, Powershell, C++ program) to tell the Arduino to run function Right or left. The Arduino can do this right? In my reading so far the code is constantly running on the Arduino so how do I tell it from the PC what to do? I’ve run the program with a button, where if you push the button Clockwise function is run and if you push the button Counter-Clockwise is run but how do I do it all inside the computer.

My goal is to call say Rotation.bat in a command line before I call MAME.exe so I can rotate the monitor to the correct alignment of the game being played.

Can I do this?

Sure - you'll need a PC program to send a message and you'll need some code in your Arduino to read and interpret the message received from the PC.

Awesome! Any good links/Tutorials you can point me towards as a beginning point?


AWOL: File/Examples/Communication/Dimmer

Thanks kindly! I shall dig into these example and see what I build. Thanks again all.