8 years, 11 months ago.

Simple Mbed code detects colour but does not send digitalout regularly only alternatively.

Hello Everyone.

I have attached the code I developed. Here it is - /media/uploads/systemproject/mbed.txt It incorporates a distance sensor (VL6180x) & a RGB sensor (TSC34725). My project is to build a machine that separates cubes by distinguishing between size and colour of each cube.

My code will send a digitalout to LED1 for red cube and LED4 for any other colour cube. The code works fine, it's just that each time I put a cube under it, the distance sensor detects the length and rgb detects the colour, but the digital out is not always consistent, it sends digitalout after every alternate placing of the cube.

Meaning, if i put a red cube under sensors, it will detect and send digitalout to LED1 then, if I remove and put same cube under it again, it detects but does not send a digitalout, finally if I remove and put the same cube under it, it will send a digitalout. - It works alternatively.

Any help will be appreciated, I have a project to submit! Thanks.

Be the first to answer this question.