# if (1 & 2 == HIGH ? how would i do this

i want to make a arduino robot but i need to make equations like if ping sensor one and two detect something but these don't do this but if these few do and those don't do this or if noise and motion detected do something you know please help do i need to uses raspberry pi?

techset: i want to make a arduino robot but i need to make equations like if ping sensor one and two detect something but these don't do this but if these few do and those don't do this or if noise and motion detected do something you know please help do i need to uses raspberry pi?

I don't understand what you writing at all. Where is your punctuation? and we don't train in mind reading.

I agree with Bill that your post is rather confusing, but I think you may be looking for Boolean operators. also known as logical operators.

if(1 & 2 == HIGH)
should be coded as:
if ( 1 == HIGH && 2 == HIGH)

Hutkikz: if(1 & 2 == HIGH) should be coded as: if ( 1 == HIGH && 2 == HIGH) see the link for more

Since I think the above code may be taken literally, I'll expand a bit.

``````const byte INPUT_A_PIN = 2;
const byte INPUT_B_PIN = 3;
byte inputState[2];

setup
{
pinMode(INPUT_A_PIN, INPUT_PULLUP);
pinMode(INPUT_B_PIN, INPUT_PULLUP);
}
loop
{
if (inputState[0] == HIGH && inputState[1] == HIGH)
{
// do stuff when both pins are high
}
}
``````

I didn't type the above in the IDE so I'm not sure I got the syntax right but it should be close.

If you work through a few tutorials this sort of stuff will become more obvious.

And don't cross-post!

techset: i want to make a arduino robot but i need to make equations like if ping sensor one and two detect something but these don't do this but if these few do and those don't do this or if noise and motion detected do something you know please help do i need to uses raspberry pi?

An Arduino is more than powerful enough for the sort of thing you're describing. The biggest problem that I can see is you want to run before you've learned to walk, or even to crawl.

Before you even consider taking on a robot project, you need to learn the basics of programming and electronics. Do a search and find some tutorials on each subject.

Build some simple test circuits and try out as many of the examples included with the IDE as you can. Once you get each working, try modifying the code a little and observe the results carefully.

Then, don't take on your robot project in one big chunk. Work out what you'll need in terms of hardware to realise the goal, then build test circuits and write test programs to get each individual device working well. When you have good control over each thing, put them together one at a time, testing extensively along the way.

Your question shows that you're making the most common mistake for Arduino beginners - trying to do everything at once, without even stopping to learn the basics. You shouldn't be thinking about combining 'ping' sensing with noise and motion sensing as well as driving motors just yet. One step at a time....

@techset, do not cross-post. Other thread removed.

In addition to cross-posting, @techset indicated in the other thread that he solved the problem on his own. So, for being a rude blood sucking vampire, he gets a few days away from the forum.