//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;
khoinvn
copilot
- Reset/Enable Pins:
- SHDN (Pin 6): This is the shutdown pin that enables the device when connected to 1.4V or higher and disables it when connected to 0.2V or less. It can also be used for soft-start with an RC filter.
Action Items: