user27026: I'm attaching a picture of my board which has the push button I want to use, but I cannot because I don't know what pin number should I write in my code.
my code:
int switchPin = Button;
int ledPin =13;

void setup() {
  // put your setup code here, to run once:
pinMode(switchPin, INPUT);
pinMode(ledPin, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
if(digitalRead(switchPin) == HIGH)
{
  digitalWrite(ledPin, HIGH);
}
else
{
  digitalWrite(ledPin, LOW);
}
}

This is a picture shows the button on the top right "green"


user3917: The schematic at makeblock.com of the mbot mcore board shows switch S3 feeding pin A7, which is an analog input pin.  Note, there is a deplorable 0.1 μF capacitor in parallel across S3, probably intended as hardware-level debouncing.
Also see the Port wiring mBot mCore board thread on the Makeblock forum, where one of the posts says there are multiple versions of the board, and provides reference links.
For example, sample code at
newinnovators.ca's “mblock-to-arduino/button-control” page (Dead link) shows pin 2 being used to sense the button.  You may need to run some tests.

27026: <p>I'm attaching a picture of my board which has the push button I want to use, but I cannot because I don't know what pin number should I write in my code.</p>

<p>my code:</p>

<pre><code>int switchPin = Button;
int ledPin =13;

void setup() {
  // put your setup code here, to run once:
pinMode(switchPin, INPUT);
pinMode(ledPin, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
if(digitalRead(switchPin) == HIGH)
{
  digitalWrite(ledPin, HIGH);
}
else
{
  digitalWrite(ledPin, LOW);
}
}
</code></pre>

<p>This is a picture shows the button on the top right "green"
<a href="https://i.stack.imgur.com/kc5Np.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kc5Np.jpg" alt=""></a></p>
 3917: <p>The <a href="https://support.makeblock.com/hc/en-us/articles/4412894402967-mCore-Main-Control-Board-for-mBot" rel="nofollow noreferrer">schematic at makeblock.com of the mbot mcore board</a> shows switch S3 feeding pin A7, which is an analog input pin.  Note, there is a deplorable 0.1 μF capacitor in parallel across S3, probably intended as hardware-level debouncing.</p>
<p>Also see the <a href="https://forum.makeblock.com/t/port-wiring-mbot-mcore-board/1379" rel="nofollow noreferrer">Port wiring mBot mCore board</a> thread on the Makeblock forum, where one of the posts says there are multiple versions of the board, and provides reference links.</p>
<p>For example, sample code at
<a href="http://www.newinnovators.ca/index.php/mbot/mblock-to-arduino/button-control" rel="nofollow noreferrer">newinnovators.ca's “mblock-to-arduino/button-control” page</a> (Dead link) shows pin 2 being used to sense the button.  You may need to run some tests.</p>
