how can I print the status of the port in arduino

Viewed 24

I want to see the status of the port but the following code gives me error

int PIN25_state = digitalRead(25);  //read PIN25
Serial.println("PIN25_state: ", PIN25_state);

The error I get is

no matching function for call to 'println(const char [14], int&)'
1 Answers

refer to Serial.print() docs , the parameters of the function print() is same as println()

where the first argument is what you want to send to through the serial , and the second argument is the format like HEX, BIN, DEC, etc...

so what you are doing is wrong.

you should do instead :

int PIN25_state = digitalRead(25);  //read PIN25
Serial.print("PIN25_state: ");
Serial.println(PIN25_state);

where print() will put the value in the same line without new line and println() will make it print then go to new line

Related