I'm writing my program in eclipse using Java. I'm trying to write it in a way that if the value is higher then 5 it reads "call recieved" if less then 5 it wouldn't respond. If anyone has any help or advice it would be appreciated
A simple IF/ELSE statement comes to mind.
Something like:
if(value >= 5)
{
//send out message " call received"
}
else
{
// do nothing
}
I'm trying to write it in a way that if the value is higher then 5 it reads "call recieved" if less then 5 it wouldn't respond.
The value of what? Tomatoes in London on Tuesday afternoon?
What is "it" that should read, or not read, what from where? How does reading correlate to responding?
This is my program write now.
public static void main(String[] args)
{
int n1=0;
String strInput;
boolean inputOK = false;
strInput = JOptionPane.showInputDialog("Enter n1: ");
do
{
try
{
n1 = Integer.parseInt(strInput);
inputOK = true;
}
catch(NumberFormatException e)
{
strInput = JOptionPane.showInputDialog("Enter n1: ");
}
} while(inputOK == false);
//System.out.println("Value: " + n1);
if(n1 >= 4)
{
System.out.println("Max called ");
}
else
{
}
}
}
At first i'm writing it as just inputing a number, but my final project is going to be reading a voltage giving a logic high number ex.5 volts to tell if a call comes through. I hope that makes sense
This is my program write now.
No it is not it is only a part of a program.
Please read the how to use this forum sticky, then modify that post to include the proper code tags. Then include all you code.
Can you explain how this is Arduino related?
What is the goal of your project?