Shopping at LEGO or Amazon?
Please use our links: LEGO.comAmazon
As an Amazon Associate we earn from qualifying purchases.

I have a coding problem in Lego EV3 Mindstorms

Hi,
I'm having trouble with codes "if then" and "if then else".
My aim is,
  • When the robot sees red it will start the D engine and drop the lego piece.
  • When the robot sees black, it will start the a motor and lower the arm and pick up the load standing on the road.
  • If the robot does not see red and black, it will continue on its way and will stop when it sees the wall.
I have uploaded the coding screenshot.
It isn't working properly.
The robot only does the stopping part when it approaches the wall.
Where am I doing wrong?



Comments

  • HuwHuw Administrator Posts: 7,076
    Perhaps try making it event driven rather than in a forever loop

    when program starts
    initialise and start moving



    when 2 is red
    ...



    when  2 is black
    ...



    when wall is close
    stop moving




    ericb
Sign In or Register to comment.

Shopping at LEGO.com or Amazon?

Please use our links: LEGO.com Amazon

Recent discussions Categories Privacy Policy Brickset.com

Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

Brickset.com is a participant in the Amazon Services LLC Associates Program, the Amazon.com.ca, Inc. Associates Program and the Amazon EU Associates Programme, which are affiliate advertising programs designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.

As an Amazon Associate we earn from qualifying purchases.