Please Help :D

Hello there… new to the forums. Hello all!. I’m new to arduino and C programming. I’m familiar with programming in assembly language and was wondering if i could get a little assistance in a particular function i want to accomplish. Im using a distance sensor and want to compare readings from two different directions and have it decide which direction has a greater distance. In assembly i could store data and do a mathematical comparison to decide. Haven’t been able to figure out how in C.

Distance 1 Data Read
Distance 2 Data Read
Distance 1 - Distance 2 = X
X>0 ; Do something
X<0; Do something else

Thanks in Advanced :smiley:

Read the data into variable. Compare the variables.

int distance1 = getDistanceFromWhateverDeviceThisIs(0);
int distance2 = getDistanceFromWhateverDeviceThatIs(1);

if (distance1 > distance2) {
  // Do something
} else {
  // Do something else

thank you... i will try this out :D