//This example code shows how to use Flux's API (https://docs.flux.ai/reference/api-overview) to add an LED simulator model to a part.
//It also changes the symbol to signal schematic users when the LED is turned on and when it's turned off based on simulator data.
//You can find this part in use in the Astable multivibrator example in your profile.
//Assigning the object ID of the terminals in the schematic editor to two variables
const anodeTerminalId = "63b04c1b-436c-3804-2af5-f29f2e88399c"; // Anode terminal ID
const cathodeTerminalId = "e5f77de8-474b-cc14-8e87-78778e0da1c6"; // Cathode terminal ID
//Get terminal objects by ID.
const anodeTerminal = flux.getNodeById(anodeTerminalId, "elementTerminal");
const cathodeTerminal = flux.getNodeById(cathodeTerminalId, "elementTerminal");
//Create the output nodes that will be visible to users in the simulator tab on the schematic
const outputVoltage = flux.createOutputNode("vout");
const inputVoltage = flux.createOutputNode("vin");
const current = flux.createOutputNode("I");
const voltageDrop = flux.createOutputNode("vdrop");
//Setting up basic parameters of an LED. You can modify these parameters and see how the simulation changes when you put it in a project
const seriesResistance = 0.42;
const emissionCoefficient = 3.73;
const saturationCurrent = 93.2e-12;
res
copilot
- Connect P1:1 to R1:1 (Path for 5V input).
- Connect R1:2 to R2:1 (This is where 3V output will be taken from).
- Connect R2:2 to the ground.
2. Using a Voltage Regulator- Connect P1:1 to the input pin of the AMS1117-3.3.
- Connect the ground pin of AMS1117-3.3 to the ground.
- Utilize the output pin of AMS1117-3.3 for your 3V source.
Final Note