Inputs and outputs. It's like programming, only using physical things.
It's always been a mystery to me how programing works. How do you tell hardware to do anything with intangible things like data? I know it seem simple to comp science folk but I find it mind boggling. Same thing as cell phones. How exactly is it that speaking into these tiny things delivers my voice instantly to the other side of the planet? All these things I find amazing even though they are "old" technology.
It's actually simple - not because comp science majors find it that way - but rather in reality. At the hardware level, you have the memory cell that can retain two states. On and off(1 and 0). Millions of them. The compendium of their states is what makes the data. You need a way to manipulate this data and return a result.
The processor(CPU) sets and retrieves this data and does whatever stuff you ask it to do with it. It relies on firmware which is the permanent code pre-wired into CPU and memory that can be invoked to move the data between memory and itself. With a way to move data between CPU and memory, and a stack, you can write a program to do anything the CPU instruction set allows you to do.
Underneath it all, are countless tiny programs, some in firmware, others in libraries, that do all sorts of things that are simple in nature, but difficult to remember and worry about.