Stray 240 in program error

Here is code it was copied and pasted , So I understand that could be an issue

is web page on what I an trying to do. I am totally new to all of this

// The human connection program - escaperoomelectronics.com
#define relay 12 // Relay control pin is pin#12
int adc = 0; // This pin will be sampled to see if the connection has been made

void setup() {
pinMode(relay,OUTPUT);
digitalWrite(relay,HIGH); // Turn active low relay off. If you're using an active high relay, change this to LOW
//Serial.begin(9600); // Comment this code back in if you're interested in seeing the analog value on your serial monitor
}

void loop() {
adc = analogRead(0);
//Serial.println(adc); // Comment this code back in if you're interested in seeing the analog value on your serial monitor
delay(100); // Wait 100ms (Optional)
if(adc > 200) // By default, the value should be 0. When both probes are connected through a human chain, you'll see anywhere from 300 to 1000
{
digitalWrite(relay,LOW); // Turn relay on if the connection is made. I'm using an active low relay board
delay(100); // Having a delay here is optional, but I like having it. You can change it if you'd like.
//Serial.println("on"); // Comment this code back in if you're interested in seeing the analog value on your serial monitor
}
else
{
digitalWrite(relay,HIGH); // Turn relay off if the human connection isn't made.
delay(100); // Wait 100ms. This is optional. You can remove this, if you'd like
//Serial.println("off"); // Comment this code back in if you're interested in seeing the analog value on your serial monitor
}
}

// End of program. Check out my website www.escaperoomelectronics.com

Stray 204 means it found some character that it didn't know what to do with. You probably copy-pasted this from some website and you picked up some extra characters from the html when you copied it. If you had read How to use this forum you would have known to post your code in code tags. If you do that then the forum software will strip out all those unwanted characters and you could copy your code back out of them and it would be clean. But you'd have to actually read the How to use this forum thread to get that. Why you would use this forum without reading that first is a mystery. But now is your chance.

Copy and paste the code into notepad(or similar) and then copy that back out. Text based editors will strip those characters out of the text they are editing.

1 Like