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);
}
}
}
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);
}
}
}
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.