//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;
andres2003pc
copilot
2(wiper) del potenciómetroR6a la resistenciaR1en su pinP1(net necesaria:NetA). Esto forma un divisor de voltaje con el potenciómetro y la resistencia.1del potenciómetroR6a la bateríaBATT1en su pin+(utiliza la netc930b6ef0de4f29ffe5ab0b921e2e28e). Esto proporciona la entrada del divisor de voltaje.3del potenciómetroR6a la bateríaBATT1en su pin-(utiliza la netd1685204eb4379f5cc8759985d55e109). Este es el terminal de tierra.P2de la resistenciaR1al pinP2(podría ser cualquier otro pinP1,P3oP4también dependiendo del color que desees) del LED RGBLED1(net necesaria:NetB). Esto controlará uno de los colores del LED RGB.R1, o si es demasiado baja, puedes disminuir el valor deR1. Además, este es un control para un solo color del LED RGB, si deseas controlar los otros colores, necesitarás un potenciómetro y una resistencia adicional por cada color.NetAyNetBmencionadas en los pasos arriba.