T
tscircuit•5w ago
xiduzo

xiduzo - maybe a stupic question, but where/how...

maybe a stupic question, but where/how do I actually import the basic components?
No description
20 Replies
Ray Kholodovsky
Ray Kholodovsky•5w ago
They should be already in without any imports!
Ray Kholodovsky
Ray Kholodovsky•5w ago
<resistor /> | tscircuit docs
A <resistor /> is an extremely common element of electronic designs. It limits the flow of electricity and is critial to making sure digital signals are properly "pulled up" or "pulled down" to set their default value as 1 or 0
Ray Kholodovsky
Ray Kholodovsky•5w ago
try a <resistor like shown here
Ray Kholodovsky
Ray Kholodovsky•5w ago
<led /> | tscircuit docs
Light emitting diodes are diodes that emit light when current passes through them. They are commonly used as indicators on a circuit board such as a "power on indicator" or "data transfer in progress indicator
xiduzo
xiduzoOP•5w ago
somehow my IDE does not recognise them? I do have
"types": [
"tscircuit",
"@tscircuit/core"
]
"types": [
"tscircuit",
"@tscircuit/core"
]
configured (yes @tscircuit/core is not neccecary with tscircuit as it contains it, but Im just tying things out here!)
No description
Ray Kholodovsky
Ray Kholodovsky•5w ago
if you are just getting started, suggest you follow the basic examples before you try to do complex weird things 🙂
Ray Kholodovsky
Ray Kholodovsky•5w ago
Quickstart CLI | tscircuit docs
The command line is the best way to use tscircuit. Using the CLI, you can just run tsci dev in a project and see previews of your circuit just like any other local development tool!
<board /> | tscircuit docs
Root element that contains all chips and traces to create a printed circuit board.
xiduzo
xiduzoOP•5w ago
sure, will check it out. thanks
Ray Kholodovsky
Ray Kholodovsky•5w ago
yeah so try to replicate the example in <board> first - that's the standard syntax and quite different from what you show.
xiduzo
xiduzoOP•5w ago
before I try to dive into this rabbit hole - is it possible to include tscircuit inside of my current (React) application?
Ray Kholodovsky
Ray Kholodovsky•5w ago
yes, there are a number of ways to do it, but first I suggest you do a basic circuit example on tscircuit.com per the docs above
Seve
Seve•5w ago
@xiduzo yep would recommend starting with tsci dev as Ray is suggesting, curious about your use case for because there are a couple ways to display on web (e.g. compiling a circuit to circuit json before displaying it can load faster for visitors, but then you can't dynamically change the circuit in browser)
xiduzo
xiduzoOP•5w ago
I have built a tool to make it easier for (non-)programmers to prototype with Arduinos, see https://microflow.vercel.app/. It would be amazing if I can also generate a circuit view based on the nodes and edges!
Microflow
Microcontrollers made simple
Seve
Seve•5w ago
oh awesome!
xiduzo
xiduzoOP•5w ago
I am now looking into the CircuitJsonPreview and
const root = new RootCircuit();

root.add(new Led({ name: "led1" }));

const circuitJson = root.getCircuitJson()
const root = new RootCircuit();

root.add(new Led({ name: "led1" }));

const circuitJson = root.getCircuitJson()
so that might be sufficient for my use case!
Seve
Seve•5w ago
yea that's a pretty low-level way to do it but pretty good! if you want to build in the browser, you can try using RunFrame, which is capable of building tscircuit code in the browser, it's the same thing our dev environment uses Examples: https://runframe.tscircuit.com/?fixtureId=%7B%22path%22%3A%22examples%2Fexample01-resistor.fixture.tsx%22%7D
Seve
Seve•5w ago
GitHub
GitHub - tscircuit/runframe: Runs tscircuit code inside a webworker...
Runs tscircuit code inside a webworker, view PCBs, schematics and 3D previews - tscircuit/runframe
xiduzo
xiduzoOP•5w ago
eventually it will need to run in an electron app (which is a browser too 😛 )
Seve
Seve•5w ago
nice! let us know how it goes!!! happy to help as you progress!!!!
xiduzo
xiduzoOP•5w ago
awesome! I'll be sure to share some progress

Did you find this page helpful?