Resistor

By Examples
static unsigned long lastTime = 0;
static float r = 10000.0; // 100k ohms

void setup() {
    chipName("Resistor");
    pin(1, "GND", GROUND);
    pin(2, "IN1");
    pin(3, "OUT1");
    pin(4, "IN2");
    pin(5, "OUT2");
    pin(6, "VCC", POWER);

    // Set a fixed resistance of 10k ohms between pin 2 and 3
    resistance(2, 3, 10000);
    // Set a non-linear resistance with an initial value of 100k ohms between pins 4 and 5
    resistance(4, 5, r, NON_LINEAR);
}


void loop() {
    // Check if 100ms have passed
    if (millis() - lastTime >= 100) {
        // Update the last recorded time
        lastTime = millis();
        // Increase the resistance value by 10k ohms
        r += 10000.0;
        if (r >= 1000000.0) {
            // Reset the resistance value to 100k ohms if it exceeds 1M ohms
            r = 10000.0;
        }
        // Update the resistance value between pins 4 and 5
        resistance(4, 5, r);
    }
}