hii!! thanks for helping me...
this is my code:-
int click1=13;
void setup()
{
pinMode(click1,INPUT_PULLUP);
Serial.begin(9600);
}
void loop()
{
digitalRead(click1);
Serial.print(click1);
}
I cannot copy and past serial monior message...
dont know why :o
but it looks like mirrored question mark(mirror image of this "?")
here is the screenshot of it...
by the way... i m not using official ardiuno mega
Most likely, the serial monitor Baud rate setting does not match the Serial.begin() setting.
Your code prints only the pin number (13), which may not be very interesting. Most people would do something like this:
Serial.print(digitalRead(click1));
When you read a digital pin, you need to assign its return value into a variable to be able to do anything with it, like displaying it on the Serial monitor. So:
int returnValue = digitalRead(click1);
Serial.println(returnValue);
Also, while pin 13 can be used for general I/O, it's also the pin that the onboard LED is attached to, so usually it's not used for input.
To copy from serial monitor, highlight the text to be copied and click ctrl-c (PC). That will copy the highlighted text to the clipboard.
The baud rate in the monitor is 57600.
The baud rate in the sketch is 9600.
They should both be the same.
Steve