0

Can I compare the Hitechnic block --> measure --> color output in a switch block? For example, if the Hitechnic color sensor is seeing black, then do something, else do another thing. If not, then how can I compare the values? The program I made takes the Hitechnic color sensor output and stores it in an array, so what I am trying to do is if the Hitechnic color sensor sees the same value (same color) stored at index 0 in the array do something. How can I accomplish this? (The Hitechnic color sensor stores different values in the array)

  • Hi mohammed! Although I'm not familiar with this particular brand of sensor, but based on your description you can already store the read value in an array. This means you have the value in hand and therefore can perform arbitrary arithmetic or logic on it, including comparing it to a given constant (the value received while the sensor sees something black) or seeing if the value is below or above a given level (what you would consider as black). If you need more help please specify the problem you are facing. Providing the source code could also let us help you more effectively. – zovits Apr 4 at 9:15
  • I would sure use your help . how can I contact you ? – mohammed ashoor Apr 4 at 12:21
  • As you seem to be unfamiliar with this site I'd recommend reading the Help section, accessible via the ? symbol in the upper right corner. In a nutshell: on this site people can ask their questions and other visitors to the site can answer them. None of us is obliged to do this, but we all do it to help the askers and to help anyone finding these questions later on. Therefore taking a discussion off-site is very much contrary to all our efforts here. You can either edit your question to incorporate any additional details or use the comment feature to do so. – zovits Apr 4 at 12:30
  • oh ok . I would like to thank you for your help, your comment really cleared things up for me . but I would to ask one more question please .should I use a compare block that is set to equal to and has the first input set as the current sensor reading and the second input set as index 0 in the array and take the output and insert it in a switch block that is set to logic ? – mohammed ashoor Apr 4 at 12:51
  • also how can I use the hitechnic color sensor block with a loop . I want the robot to do something until the hitechnic color sensor sees one of the colors in the list . how can I make a list that has a bunch of colors so I can use it in the loop block – mohammed ashoor Apr 4 at 12:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.