if Statment

I will try my best to explain my problem …… I am playing about with a touch screen I am getting 2 analogue readings from it that give me a grid reference depending where I touch the screen I am trying to write a sketch so depending where I touch the screen it will do different things
for example : if I put my finger on the screen grid ref 230,166, it would print to screen ( or whatever) but I would need to put some tolerance in incase my finger did not hit exactly the same place
so I need the “if statement to say” …. if outputValue >225 but <235 and outputValue1 >161 but <169 then do whatever
Thanks for reading

/*+-
 
 created 29 Dec. 2008
 modified 30 Aug 2011
 by Tom Igoe
 
 This example code is in the public domain.
 
 */

// These constants won't change.  They're used to give names
// to the pins used:
const int analogInPin = A0;  // Analog input pin that the potentiometer is attached to
const int analogInPin1 = A1;

int sensorValue1 = 1;
int sensorValue = 0;        
int outputValue = 0;        // value output to the PWM (analog out)
int outputValue1 = 1;
void setup() {
  // initialize serial communications at 9600 bps:
  Serial.begin(9600); 
}

void loop() {
  // read the analog in value:
  sensorValue = analogRead(analogInPin);            
  
  sensorValue1 = analogRead(analogInPin1);
  
  // map it to the range of the analog out:
  outputValue = map(sensorValue, 0, 1023, 0, 300);  
  outputValue1 = map(sensorValue1, 0, 1023, 300,0); 
  
  
  // change the analog out value:
  analogWrite(outputValue1, outputValue);           

 //print the results to the serial monitor:
  Serial.print("input 1 = " );                       
  Serial.print(outputValue1);      
  Serial.print("     input 2 = ");      
  Serial.println(outputValue);   
  
   
   
   if (outputValue1 <230)// if input is less than 230 print 
 
  {
     
     
     Serial.print("Power button  " ); 
    

  }
 

 
 
  delay(800);                     
}

Logical and. If something is this AND something is that.

if((something > 225) && (something <235)){

}

thanks but that is just 1 value i have 2

so I need the “if statement to say” …. if outputValue >225 but <235 and outputValue1 >161 but <169 then do whatever

if(outputValue > 225 && outputValue < 235 && outputValue1 > 161 && outputValue1 < 169)
{
   // do whatever
}

thanks thanks thanks it easy when you know how

If you were to view your screen as a grid of small squares you could divide the horizontal number by the horizintal width of the blocks and the same with the vertical number. for example - if the horizontal resolution were 256 points, and the block size were 8 pixels wide, you would come up with an integer from 0 to 32 without having to do the long compare statement.could then be done with a select statement.

maddave: thanks but that is just 1 value i have 2

Woops, misread that, but yeah same principal of logical and.