Custom components
A custom component in PyRasp is built from the parts in the shop — resistors, LEDs, transistors, sensors, displays — wired together and reused as one piece. There is no way to upload a brand-new part with its own behaviour: everything you build is made of parts the simulator already models, so it behaves, costs and gets judged exactly like the same parts wired by hand.
There are two ways to make one.
In Python: a Module, kept as a component
In circuit.py (the workspace, the sandbox and Lab mode alike), subclass Module, create and wire the parts in build(), and publish the pins the outside world may use with expose():
class TrafficLight(Module):
def build(self):
red, green = LED("red"), LED("green")
r1, r2 = Resistor(330), Resistor(330)
r1 >> red
r2 >> green
red.cathode >> green.cathode
self.expose(red=r1.pin1, green=r2.pin1, gnd=red.cathode)
The board draws it as one group, and it costs the sum of its parts. It can take arguments, act as a link in a >> chain and live in its own file for reuse — all of that is in wiring modules. Save it as a custom component and it joins your library: every workspace can import it, the daily contest included.
On the Lab board: a saved module
Wire a few parts on the board, select them and press Save module in the inspector. The module appears under Modules in the Parts panel; dragging it onto a board places its parts and internal wires in one step. Export it as a .raspsim-module.json file to send to someone else. Saved modules has the details.
When a part is missing
Custom components are always built from parts the simulator already models. A brand-new part — a sensor or chip the simulator does not have — cannot be added from the app; it has to be added to the simulator itself before anyone can use it.