Lego power functions is exactly this (but for very limited circuits). There are battery boxes for power, switches (both mechanical, and remote-controlled), lights, motors, etc.
The power functions pieces have special bricks which embed electrical endpoints which click together when the bricks are connected. The system is basically 4 wires - 2 which propagate the power rails to downstream pieces, and 2 more wires which are for PWM controlling of motor spin rate.
I would love it if they added more electronic components to this set (eg. timers, sounds, more sensors, etc). If you like to tinker, you can cut apart these wires and hook up the control wires to an raspberrypi-controlled circuit.
There's probably even more circuits possible with Mindstorms components, but I'm not familiar enough w/ Mindstorms to comment.
The power functions pieces have special bricks which embed electrical endpoints which click together when the bricks are connected. The system is basically 4 wires - 2 which propagate the power rails to downstream pieces, and 2 more wires which are for PWM controlling of motor spin rate.
I would love it if they added more electronic components to this set (eg. timers, sounds, more sensors, etc). If you like to tinker, you can cut apart these wires and hook up the control wires to an raspberrypi-controlled circuit.
There's probably even more circuits possible with Mindstorms components, but I'm not familiar enough w/ Mindstorms to comment.