static int lastState = 0;
static int count = 0 ; //number of pulses for each card
static int countb = 0 ;
int outputPin = 13; //names pins
int inputPin =10;
int fullPin =8;
int breakPin =5;
int maxCount ; //number of pulse's before this card shuts off
//int newcard = 0;
void setup()
{
Serial.begin(9600); //just for now so i can see what's going on
digitalWrite (fullPin, HIGH);
pinMode(outputPin,OUTPUT);
pinMode(inputPin, INPUT); //make's pin 10 input pin
pinMode(breakPin, INPUT); //this is used to breakout of while loop
digitalWrite (outputPin, LOW);
}
void loop()
{
while (Serial.available() == 0); // this is going to be input from card
int val = Serial.read(); //will be input from card reader
if (val == '1') //if this is the card number do the next stuff if not keep looking
{
Serial.println("card 1 ");
while(!digitalRead(5))
{
int maxCount =20; //number of pulse's befor end
int newState = digitalRead(inputPin); //pulse from flow meter
if (newState != lastState) //detect change
{
Serial.println(count); //just for now so i can see what's going on
count ++; //adds one to count
lastState = newState;
if (count < maxCount)
{
digitalWrite (outputPin, HIGH);
}
if (count == maxCount) //when count gets to the set number sends 5v to pin 13
{
Serial.println("on credit left");
digitalWrite(outputPin, LOW); // power to relay to shut flow
break;
}
}
} // AT THIS POINT I NEED IT TO GO BACK TO LINE 30 ......while (Serial.available() == 0)
// CAN ANY ONE TELL ME HOW TO DO THIS
{
}
}
// looks for next card numder
if (val == '2') //if this is the card number do the next stuff if not keep looking
{
}
Serial.println("card 2 step 1 ");
while(!digitalRead(5))
{
int maxCount =20; //number of pulse's befor end
int newState = digitalRead(inputPin); //pulse from flow meter
if (newState != lastState) //detect change
{
Serial.println(countb); //just for now so i can see what's going on
countb ++; //adds one to count
lastState = newState;
Serial.println(countb);
if (count > maxCount) //when count gets to the set number sends 5v to pin 13
{
Serial.println("on credit left");
digitalWrite(outputPin, HIGH); // power to relay to shut flow
break;
}
}
}
{
}
}
after break
AT THIS POINT I NEED IT TO GO BACK TO LINE 30 ......while (Serial.available() == 0)
// CAN ANY ONE TELL ME HOW TO DO THIS
Well, you could simply fall out of of "loop".
You almost never, ever need to use goto.
Can I recommend you use the auto-format tool (ctrl-T) before posting - your coding style is very hard to read.
how do i fall out fo the loop
return;