I am new to NBC programming and am trying to program my Lego NXT Brick to search for and follow a line of black electrical tape that I have on the floor (I have the light sensor in the front and pointing straight down at the ground). As of right now, the light turns on, but the robot just continues to go over the tape without acknowledging it. I also have it set up to stop and turn around if it bumps into a wall, which is working. The only thing that isn't working is acknowledging and following the black tape when the light goes over it. Can anyone take a look at my code and tell me where I am going wrong? Here is a picture of the robot if that makes things easier: 97093d8f8280b968498e0fd9148b0023

                                                dseg segment
  Switch sword 0
  Volume sword 0
  Level sword 0
  Distance sword 0
dseg ends

thread main
  SetSensorTouch(IN_1)    // touch sensor connected to IN_1
  SetSensorSound(IN_2)    // sound sensor connected to IN_2
  SetSensorLight(IN_3)    // Light Sensor connected to input 3
  SetSensorUltrasonic(IN_4) // Ultrasonic Sensor connected to input 4
  OnFwd(OUT_BC,80)     // move forward

  CheckSensor:

    ReadSensor(IN_1,Switch)       // reads current value of sensor (0/1)
    brtst EQ, CheckSensor, Switch // branch to CheckSensor if Switch = 0
                                  // i.e., exit the loop when Switch = 1


  OnRev(OUT_BC,40)      // move backward
  wait 500
  OnFwd(OUT_B,20)       // turn
  wait 500

  jmp CheckSound

  CheckSound:
  ReadSensor(IN_2, Volume)
  brcmp GT, ExitCheck, Volume, 60

  jmp CheckSound

  ExitCheck:

  OnFwd(OUT_BC,60)

  jmp CheckLight

  CheckLight:
  ReadSensor(IN_3,Level)
  brcmp LT, CheckLight, Level, 60

  ReadSensorUS(IN_4,Distance)
  brcmp LT, EndPoint, Distance, 30

  OnFwd(OUT_C, 10)

  FindPath:
  ReadSensor(IN_3,Level)
  brcmp GTEQ, FindPath, Level, 60

  OnFwd(OUT_BC, 60)

  jmp CheckLight

  EndPoint:

  Off(OUT_BC)

  wait 1500

  PlayTone(TONE_C5, 400)
  wait 500
  PlayTone(TONE_C5, 400)
  wait 500
  PlayTone(TONE_C5, 450)
  wait 500
  PlayTone(TONE_A4, 250)
  wait 260
  PlayTone(TONE_E5, 150)
  wait 180
  PlayTone(TONE_C5, 400)
  wait 500
  PlayTone(TONE_A4, 250)
  wait 260
  PlayTone(TONE_E5, 150)
  wait 180
  PlayTone(TONE_C5, 400)
  wait 750

  PlayTone(TONE_F5, 400)
  wait 500
  PlayTone(TONE_F5, 400)
  wait 500
  PlayTone(TONE_F5, 450)
  wait 500
  PlayTone(TONE_G5, 250)
  wait 260
  PlayTone(TONE_F5, 150)
  wait 180
  PlayTone(TONE_C5, 400)
  wait 500
  PlayTone(TONE_A4, 250)
  wait 260
  PlayTone(TONE_E5, 150)
  wait 180
  PlayTone(TONE_C5, 400)
  wait 750

  wait 1000

  PlayTone(TONE_B5, 100)
  wait 120
  PlayTone(TONE_B5, 175)
  wait 220
  PlayTone(TONE_B5, 300)
  wait 320
  PlayTone(TONE_G5, 100)
  wait 120
  PlayTone(TONE_B5, 200)
  wait 220
  PlayTone(TONE_D6, 275)
  wait 325
  PlayTone(TONE_D4, 400)
  wait 400

endt

Nope, sorry. See the ToS:

Posts contributed to the community immediately become the property of DaniWeb upon submission. Members may edit their posts for a limited time period immediately after, for the purpose of correcting spelling and grammar mistakes and accidental ommissions. After this initial period expires, posts may only be edited or deleted by DaniWeb team members, and only in cases where they do not comply with our forum rules for the purpose of making said content comply with all rules. As a discussion community, posts contributed by many members work together to form coherent discussions. Altering or deleting individual posts may have consequences that unfairly extend to other members of the community. All members are held responsible for their actions. As always, think before you permanently post something on the public Internet.

Mods, since no one has responded, can you take this post down?

Look on the bright side, someone might come up with a solution and it may solve someone else's problem many, many years into the future....

This article has been dead for over six months. Start a new discussion instead.