void setup() {
// put your setup code here, to run once:
Serial1.begin(115200);
Serial1.println("Hello, Raspberry Pi Pico!");
// Pin Definitions
const int ; // Analog pin for flex sensor input
const int ; // Digital pin for LED output
// Variables
int flexValue; // Variable to store flex sensor reading
int threshold = 500; // Adjust this threshold value as needed
void setup() {
// Initialize serial communication at 9600 baud
Serial.begin(9600);
// Set LED pin as output
pinMode(ledPin, OUTPUT);
}
void loop() {
// Read flex sensor value
flexValue = analogRead(flexPin);
// Print flex sensor value to serial monitor
Serial.print("Flex Sensor Value: ");
Serial.println(flexValue);
// If flex sensor value is above the threshold, indicate strain with LED
if (flexValue > threshold) {
digitalWrite(ledPin, HIGH); // Turn on LED
Serial.println("Muscle strain detected!");
} else {
digitalWrite(ledPin, LOW); // Turn off LED
}
// Delay for stability
delay(100);
}
}
void loop() {
}