'Lego' brick - from physical to virtual using resistors

I would start by reading up on voltage dividers and the selection of resistor values.