1

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"

6
  • 1
    Datasheet says? Commented Sep 30, 2016 at 18:13
  • 1
    What does the user manual say? I assume you have read it? Commented Sep 30, 2016 at 18:15
  • it doesn't have manual with it! Commented Sep 30, 2016 at 18:22
  • and I looked online, but I couldn't find one! Commented Sep 30, 2016 at 18:24
  • 2
    Abdulrahman, what's the name of the board, or what identifying text is on it, or what do you think it's called? Commented Sep 30, 2016 at 18:24

1 Answer 1

3

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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.