const int flexPin = A0; // Analog pin connected to the flex sensor const int ledPin = 9; // Digital pin connected to the LED int flexThreshold = 600; // Threshold value to trigger LED (adjust as needed) void setup() { pinMode(ledPin, OUTPUT); Serial.begin(9600); // For monitoring sensor values } void loop() { int flexValue = analogRead(flexPin); Serial.println(flexValue); // View this in Serial Monitor to calibrate if (flexValue > flexThreshold) { digitalWrite(ledPin, HIGH); // Turn LED on } else { digitalWrite(ledPin, LOW); // Turn LED off } delay(100); // Small delay }