Go to https://www.l33t.uk/bitbot/?page_id=496 for instructions on how to configure Arduino IDE for use with the BBC Micro:bit if you haven’t already. This code builds on the code found at https://www.l33t.uk/bitbot/?page_id=592
I have added code for a light seeking robot. I saw little point to create code for a light avoider; the code is similar just inverted. I opened the previous project and created a new tab called _02_LightSensitive and added the below code;
I then called the startLightSensitive() method from the loop() method in the _00_programLoop tab.
Colours are the same Cyan = rooms too bright, Pink = waiting for light, Green = following light.
The code for this can be downloaded from here or the resources section.