const int ctSensorPin = A0; // Connect the CT sensor output to digital pin 2
const int threshold = 500; // Set your current threshold value (adjust as needed)
const int ledPin = 12; // Connect an LED or use the built-in LED on pin 13
void setup() {
Serial.begin(9600);
pinMode(ctSensorPin, INPUT);
pinMode(ledPin, OUTPUT);
}
void loop() {
int sensorValue = analogRead(ctSensorPin);
Serial.println(sensorValue);
// Check if the current exceeds the threshold
if (sensorValue > threshold) {
digitalWrite(ledPin, HIGH); // Turn on the LED or send a digital signal
delay(1000); // Wait for 1 second (adjust as needed)
digitalWrite(ledPin, LOW); // Turn off the LED or reset the digital signal
}
delay(100); // Adjust the delay as needed for your application
}
const int ctSensorPin = A0; // Connect the CT sensor output to digital pin 2
const int threshold = 500; // Set your current threshold value (adjust as needed)
const int ledPin = 13; // Connect an LED or use the built-in LED on pin 13
void setup() {
Serial.begin(9600);
pinMode(ctSensorPin, INPUT);
pinMode(ledPin, OUTPUT);
}
void loop() {
int sensorValue = analogRead(ctSensorPin);
Serial.println(sensorValue);
// Check if the current exceeds the threshold
if (sensorValue > threshold) {
digitalWrite(ledPin, HIGH); // Turn on the LED or send a digital signal
delay(1000); // Wait for 1 second (adjust as needed)
digitalWrite(ledPin, LOW); // Turn off the LED or reset the digital signal
}
delay(100); // Adjust the delay as needed for your application
}