mBot - Programme detect brightness from external source



I would like to program in the way that the mbot detect the brightness from a phone flash light then perform some task. Unfortunately is not working anything that I have missed?


@Kenneth_Phang,could you please send your program to us by Support@makeblock.cc? We would have a check firstly,thanks!


Sent to the support team please help need to teach this asap.


I think you got me wrong here. I want to detect brightness from the phone flashlight then perform some task see the lighton block.


i found the onboard light sensor’s reading is always 1023 after upgrading to v3.2. take a look, maybe that is the reason why it doesn’t work. simple fix is read the A6 (which is connected to onboard light sensor directly) with arduino block, rather than the light sensor block in mbot. Good Luck…



Hi Kenneth, I just ran a test program. I used light sensor block instead of lighton. It works.

I didn’t find lighton block in mBlock v3.2. You can run a similar program to test light sensor as shown in the pic. Or you can use the latest mBlock (v3.2), which can be download from http://www.mblock.cc/.


@Sunny_Sun Light sensor block works with mBlock v3.2 in my test.

If possible, you can upload your program, so I can figure it out.


Hi, Pioneer, thank you for your reply, I use the same code as you, same number. see here.

if i switch to read the arduino code for above program, it look like below: , it seems the reading is from A8, rather than A6. and if i change the code to read A6, it does change with the light:

I hope this can help you debug this problem



I tested on the mac version it didn’t work. Not the windows version. I tested the windows version it work.


Ok guys tested with the new version 3.2.1 it works


Hi Ted, the light sensor on mBot is connected with A6. You can check the mCore pcb diagram at https://github.com/Makeblock-official/mBot/blob/master/pcb/mCore.pdf

So, in Arduino Program mode, A6 should be selected to read data from light sensor. I’ve talked with our mBlock developer. It’s a bug of defining light sensor port on mBot block. Thanks for your feedback and support. :smile:


My light sensor doesn’t appear to be working, but I don’t have a Read Analog Pin command. Was that removed?


Hi ratemyrobot,

With the Arduino option chosen under Extension,you can see the program block read analog pin.


Ok, I see the issue now, Chromebook doesn’t have that extension. I’ll have to use the desktop application to use the onboard light sensor.

It also appears as though there is a bug with the “set led on board” command. When you load a program on the desktop app that was created on a Chromebook, it says that command is now undefined. Doing the opposite (creating on the desktop app and then loading on the Chromebook) seems to work.


Hi ratemyrobot,

The chromebook version mBlock is Experimental version, For the issue of it, we will record. Thanks for your feedback!