static unsigned long lastTime = 0;
static float current = 0.0001; // 100 uA
void setup() {
chipName("Non Linear Current Source");
pin(1, "GND", GROUND);
pin(2, "IN");
pin(3, "OUT");
pin(4, "VCC", POWER);
// Set up a non-linear current source between pins 2
// and 3, with an initial current of 100 uA
currentSource(3, 2, current, NON_LINEAR);
}
void loop() {
// Check if 100 ms have passed
if (millis() - lastTime >= 100) {
// Update the last recorded time
lastTime = millis();
// Increase the current by 100 uA
current += 0.0001;
if (current >= 0.01) {
// Reset the current to 100 uA if it reaches 10 mA
current = 0.0001;
}
// Update the current source with the new current value
currentSource(3, 2, current);
}
}