hello everyone, I had an idea: what would happen if I tried to make pin -1 high during runtime? I tried to figure it out with this code:
int myPin;
char incomingByte[50];
int change=0;
int data=-1;
int l=0;
void setup() {
Serial.begin(9600);
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
}
void loop() {
// send data only when you receive data:
if (Serial.available() > 0) {
// read the incoming byte:
incomingByte[l] = (char)Serial.read();
if(incomingByte[l-1]=='-' && incomingByte[l]=='1')
{
digitalWrite(13, HIGH);
change=-1;
digitalWrite(change, HIGH);
data=digitalRead(change);
Serial.print("data: ");
Serial.println(data);
}
// say what you got:
Serial.print("I received: ");
Serial.println(incomingByte);
l++;
}
}
When I uploaded it to my Uno I expected it to crash in some way, but instead it acted normal. Why?
thank you,
popa