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 maxCount =100; //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
}
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 step 1 ");
int maxCount =1; //number of pulse's befor end
int newState = digitalRead(inputPin); //pulse from flow meter
if (newState != lastState) //detect change
//Serial.println("card1 step 2"); //just for now so i can see what's going on
//Serial.println(count); //just for now so i can see what's going on
count ++; //adds one to count
// Serial.println("card1 step 3");
lastState = newState;
//Serial.println("card1 step 4");
Serial.println(count);
if (count > maxCount) //when count gets to the set number sends 5v to pin 13
{// Serial.println("card1 step 5");
digitalWrite(outputPin, HIGH); // power to relay to shut flow
}
}
{}
}
// 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");
int maxCountb =1000; //number of pulse's befor end
int newState = digitalRead(inputPin); //pulse from flow meter
if (newState != lastState)
// Serial.println(count);
{
countb ++; //adds one to count
lastState = newState;
if (count > maxCountb) //when count gets to the set number sends 5v to pin 13
{
digitalWrite(outputPin, HIGH); // power to relay to shut flow
}
}
}
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 maxCount =100; //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
}
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 step 1 ");
int maxCount =1; //number of pulse's befor end
int newState = digitalRead(inputPin); //pulse from flow meter
if (newState != lastState) //detect change
//Serial.println("card1 step 2"); //just for now so i can see what's going on
//Serial.println(count); //just for now so i can see what's going on
count ++; //adds one to count
// Serial.println("card1 step 3");
lastState = newState;
//Serial.println("card1 step 4");
Serial.println(count);
if (count > maxCount) //when count gets to the set number sends 5v to pin 13
{// Serial.println("card1 step 5");
digitalWrite(outputPin, HIGH); // power to relay to shut flow
}
}
{}
}
// 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");
int maxCountb =1000; //number of pulse's befor end
int newState = digitalRead(inputPin); //pulse from flow meter
if (newState != lastState)
// Serial.println(count);
{
countb ++; //adds one to count
lastState = newState;
if (count > maxCountb) //when count gets to the set number sends 5v to pin 13
{
digitalWrite(outputPin, HIGH); // power to relay to shut flow
}
}
}
why wont this compile
Moderator edit: Code box posting corrected. AWOL