whats up got something wrong

why why why is the if not working ( if val + 1)

static int lastState = 0;
static int count = 0 ;
int outputPin = 13;//names pins
int inputPin =10;
int fullPin =8;
int maxCount =100;//number of pulse's befor end

void setup()
{
Serial.begin(9600);
digitalWrite (fullPin, HIGH);
pinMode(outputPin,OUTPUT);
pinMode(inputPin, INPUT);//make's pin 10 input pin
while (Serial.available() == 0);
int val = Serial.read();
if (val = "1" )
{
Serial.println("so far so good");
}
}

void loop()
{
int newState = digitalRead(inputPin);
if (newState != lastState)
// Serial.println(count);
{
count ++;//adds one to count
lastState = newState;
if (count > maxCount)//when count gets to the set number sends 5v to pin 13
{
digitalWrite(outputPin, HIGH);
}
}
} :blush:

Comparison for equality uses ==, not =

if (val = "1" )

Did you mean to use: if (val == "1" ) //need two ==

Lefty

no tryed that

What are you talking about?
Why is this a poll?

static int lastState = 0;
static int count = 0 ;
int outputPin = 13;//names pins
int inputPin =10;
int fullPin =8;
int maxCount =100;//number of pulse's befor end

void setup()
{
Serial.begin(9600);
digitalWrite (fullPin, HIGH);
pinMode(outputPin,OUTPUT);
pinMode(inputPin, INPUT);//make's pin 10 input pin
while (Serial.available() == 0);
int val = Serial.read();
if (val == "1")
{
Serial.println("so far so good");
}
}

void loop()
{
int newState = digitalRead(inputPin);
if (newState != lastState)
// Serial.println(count);
{
count ++;//adds one to count
lastState = newState;
if (count > maxCount)//when count gets to the set number sends 5v to pin 13
{
digitalWrite(outputPin, HIGH);
}
}
}

will not work

Define 'work'

compile

val == "1" will not work because it is an invalid comparison.

It is an invalid comparison because "1" is a c style string of one character, and thus you are attempting to compare an int to a pointer.

What I believe you want is:
val == '1'

The single quotes indicate a single character, not a string, and comparisons of ints and chars is valid.

For future reference:
If a sketch fails to compile, tell us that. 'It doesn't work' implies you actually ran the sketch, but it didn't do what you wanted.
Please use the # icon on the toolbar to allow you to post code in a code box.

your the man or should i say your the '1' .....thank you

ok sorry and thanks