delay and millis

Arduino: 1.8.6 Hourly Build 2018/01/03 03:33 (Windows 10), Board: "Arduino Mega ADK"

C:\Users\imman\Desktop\raw\raw.ino: In function 'void setup()':

raw:83: error: 'pulseCounter' was not declared in this scope

attachInterrupt(sensorInterrupt, pulseCounter, FALLING); //you can use Rising or Falling

^

C:\Users\imman\Desktop\raw\raw.ino: In function 'uint8_t getFingerprintEnroll()':

raw:518: error: 'SetSolinoidValve' was not declared in this scope

SetSolinoidValve();

^

raw:524: error: 'pulseCounter' was not declared in this scope

attachInterrupt(sensorInterrupt,pulseCounter, FALLING);

^

raw:531: error: a function-definition is not allowed here before '{' token

{

^

raw:537: error: a function-definition is not allowed here before '{' token

{

^

Multiple libraries were found for "Adafruit_Fingerprint.h"
Used: C:\Users\imman\Desktop\arduino_flow\arduino-nightly\libraries\Adafruit_Fingerprint_Sensor_Library-1.1.1
Not used: C:\Users\imman\Desktop\arduino_flow\arduino-nightly\libraries\FingerPrint
Multiple libraries were found for "SoftwareSerial.h"
Used: C:\Users\imman\Desktop\arduino_flow\arduino-nightly\hardware\arduino\avr\libraries\SoftwareSerial
Not used: C:\Users\imman\Desktop\arduino_flow\arduino-nightly\libraries\SoftwareSerial
exit status 1
'pulseCounter' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

You can't declare functions inside other functions, in this case, inside getFingerprintID.

I think you've got way too much code, which makes spotting problems like this much harder.

yaa..it has so many codes..my project is if i keep my fingerprint then the solenoid valve will open and flow sensor will detect the flow and closes the solenoid valve when the limit reaches..so i has 2 r 3 sensor reason for this messy codes..i want to mingle these 3 codes

Can we start again ?
Let's start with the basics

Arrays[]

int state[11];   or whatever [size] you need...

state[0] = 0;
state[1] = 0;
state[2] = 0;

Simpler...

#define NUM_MEMBERS 10
for (char x=0; x<NUM_MEMBERS; x++)
  state[x] = 0;

-- or if we're going to stay with discrete (HORRIBLE) variables ...

Switch () { case } blocks
As per your existing code...

 Switch (finger.fingerID) {
  case 1:
     digitalWrite(10,State1);
     State1=!State1;  
     break;
  case: 2
     digitalWrite(10,State2);
     State2=!State2; 
     break;
  case: 3
     digitalWrite(10,State3);
     State3=!State3;  
     break;
  case: 4
--- etc.
}

Let's try a simpler way to replace ALL that!

     digitalWrite(10, state[finger.fingerID]);
     state[finger.fingerID] = !state[finger.fingerID];

Now, we can change the ints to bools - just to be 'correct'.

bool state[11];   or whatever [size] you need...
... or with the above constant...
bool state[NUM_MEMBERS];

lastchancename:
Simpler...

#define NUM_MEMBERS 10

for (char x=0; x<NUM_MEMBERS; x++)
  state[x] = 0;

or even simpler:

int state[11];

globals are by default initialized to zero!

Yeah - I was trying to illustrate that he could initialise them to whatever value he needed

still got this my error..

Arduino: 1.8.6 Hourly Build 2018/01/03 03:33 (Windows 10), Board: "Arduino Mega ADK"

C:\Users\imman\Desktop\raw\raw.ino: In function 'void setup()':

raw:74: error: 'pulseCounter' was not declared in this scope

attachInterrupt(sensorInterrupt, pulseCounter, FALLING); //you can use Rising or Falling

^

C:\Users\imman\Desktop\raw\raw.ino: At global scope:

raw:262: error: expected constructor, destructor, or type conversion before '(' token

delay(1500);

^

raw:263: error: 'lcd' does not name a type

lcd.clear();

^

raw:264: error: 'lcd' does not name a type

lcd.setCursor(0, 0);

^

raw:265: error: 'lcd' does not name a type

lcd.print("Place");

^

raw:266: error: 'lcd' does not name a type

lcd.setCursor(0, 1);

^

raw:267: error: 'lcd' does not name a type

lcd.print("your Finger..!");

^

raw:268: error: 'Serial' does not name a type

Serial.print(" with confidence of "); Serial.println(finger.confidence);

^

raw:268: error: 'Serial' does not name a type

Serial.print(" with confidence of "); Serial.println(finger.confidence);

^

raw:269: error: expected unqualified-id before 'return'

return finger.fingerID;

^

raw:270: error: expected declaration before '}' token

}

^

Multiple libraries were found for "Adafruit_Fingerprint.h"
Used: C:\Users\imman\Desktop\arduino_flow\arduino-nightly\libraries\Adafruit_Fingerprint_Sensor_Library-1.1.1
Not used: C:\Users\imman\Desktop\arduino_flow\arduino-nightly\libraries\FingerPrint
Multiple libraries were found for "SoftwareSerial.h"
Used: C:\Users\imman\Desktop\arduino_flow\arduino-nightly\hardware\arduino\avr\libraries\SoftwareSerial
Not used: C:\Users\imman\Desktop\arduino_flow\arduino-nightly\libraries\SoftwareSerial
exit status 1
'pulseCounter' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

raw.ino (13.1 KB)

Your opening and closing brackets for the different functions are not correct. I would put every bracket on its own line, and then use autoformat (ctrl +T) to line things up. Make sure everything matches. You can not setup a function within another function.

I can see that the pulseCounter isr and SetSolinoidValue() are both within getFingerprintEnroll().

#include <Adafruit_Fingerprint.h>
#include<Arduino.h>
#include <SoftwareSerial.h>
#include <Wire.h>
#include <LiquidCrystal.h>
int getFingerprintIDez();
uint8_t getFingerprintEnroll();
// pin #2 is IN from sensor (GREEN wire)
// pin #3 is OUT from arduino (WHITE wire)
SoftwareSerial mySerial(2, 3);
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);

// On Leonardo/Micro or others with hardware serial, use those! #0 is green wire, #1 is white
//Adafruit_Fingerprint finger = Adafruit_Fingerprint(&Serial1);
LiquidCrystal lcd(12, 11, 6, 5, 4, 3);
int sensorInterrupt = 0; // interrupt 0
int sensorPin = 2; //Digital Pin 2
int FingerMode = 0 ;
int SkipHead = 0;
int state[11];
uint8_t id;
unsigned int SetPoint = 400; //400 milileter

/The hall-effect flow sensor outputs pulses per second per litre/minute of flow./
float calibrationFactor = 4.5; //You can change according to your datasheet

volatile byte pulseCount = 0;

float flowRate = 0.0;
unsigned int flowMilliLitres = 0;
unsigned long totalMilliLitres = 0;

unsigned long oldTime = 0;
void setup()
{
pinMode(8, INPUT_PULLUP); //orange finger detect
pinMode(9, INPUT_PULLUP); //white enroll

pinMode(10, OUTPUT); //relay
digitalWrite(10, LOW);
lcd.begin(16, 2); // initialize the lcd
// lcd.backlight(); //default backlight on
lcd.clear();
// while (!Serial); // For Yun/Leo/Micro/Zero/...

Serial.begin(9600);
pinMode(sensorPin, INPUT);
digitalWrite(sensorPin, HIGH);
attachInterrupt(sensorInterrupt, pulseCounter, FALLING); //you can use Rising or Falling
lcd.print("finger detect");
// delay(100);
// set the data rate for the sensor serial port
finger.begin(57600);

if (finger.verifyPassword()) {
// lcd.print("Found fingerprint!");
} else {
// lcd.print("Did not find fingerprint sensor :(");
while (1);
}
}

....

can u solve something in this,,,..

errorr is

Arduino: 1.8.6 Hourly Build 2018/01/03 03:33 (Windows 10), Board: "Arduino Mega ADK"

C:\Users\imman\Desktop\raw\raw.ino: In function 'void setup()':

raw:74: error: 'pulseCounter' was not declared in this scope

attachInterrupt(sensorInterrupt, pulseCounter, FALLING); //you can use Rising or Falling

^

C:\Users\imman\Desktop\raw\raw.ino: At global scope:

raw:263: error: expected constructor, destructor, or type conversion before '(' token

delay(1500);

^

raw:264: error: 'lcd' does not name a type

lcd.clear();

^

raw:265: error: 'lcd' does not name a type

lcd.setCursor(0, 0);

^

raw:266: error: 'lcd' does not name a type

lcd.print("Place");

^

raw:267: error: 'lcd' does not name a type

lcd.setCursor(0, 1);

^

raw:268: error: 'lcd' does not name a type

lcd.print("your Finger..!");

^

raw:269: error: 'Serial' does not name a type

Serial.print(" with confidence of "); Serial.println(finger.confidence);

^

raw:269: error: 'Serial' does not name a type

Serial.print(" with confidence of "); Serial.println(finger.confidence);

^

raw:270: error: expected unqualified-id before 'return'

return finger.fingerID;

^

raw:271: error: expected declaration before '}' token

}

^

Multiple libraries were found for "Adafruit_Fingerprint.h"
Used: C:\Users\imman\Desktop\arduino_flow\arduino-nightly\libraries\Adafruit_Fingerprint_Sensor_Library-1.1.1
Not used: C:\Users\imman\Desktop\arduino_flow\arduino-nightly\libraries\FingerPrint
Multiple libraries were found for "SoftwareSerial.h"
Used: C:\Users\imman\Desktop\arduino_flow\arduino-nightly\hardware\arduino\avr\libraries\SoftwareSerial
Not used: C:\Users\imman\Desktop\arduino_flow\arduino-nightly\libraries\SoftwareSerial
exit status 1
'pulseCounter' was not declared in this scope

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

raw:74: error: 'pulseCounter' was not declared in this scope

pulseCounter is not the same thing as pulseCount

I can't help noticing that there's no delay(1500) in the code you posted, yet code that isn't there gave you an error message. Amazing.

Arduino: 1.8.6 Hourly Build 2018/01/03 03:33 (Windows 10), Board: "Arduino Mega ADK"

new_raw:487: error: 'void pulseCounter()' redeclared as different kind of symbol

void pulseCounter()

^

C:\Users\imman\Desktop\new_raw\new_raw.ino:31:14: note: previous declaration 'volatile int pulseCounter'

volatile int pulseCounter;

^

C:\Users\imman\Desktop\new_raw\new_raw.ino: In function 'int getFingerprintIDez()':

new_raw:274: error: a function-definition is not allowed here before '{' token

uint8_t getFingerprintEnroll() {

^

new_raw:497: error: expected '}' at end of input

}

^

Multiple libraries were found for "Adafruit_Fingerprint.h"
Used: C:\Users\imman\Desktop\arduino_flow\arduino-nightly\libraries\Adafruit_Fingerprint_Sensor_Library-1.1.1
Not used: C:\Users\imman\Desktop\arduino_flow\arduino-nightly\libraries\FingerPrint
Multiple libraries were found for "SoftwareSerial.h"
Used: C:\Users\imman\Desktop\arduino_flow\arduino-nightly\hardware\arduino\avr\libraries\SoftwareSerial
Not used: C:\Users\imman\Desktop\arduino_flow\arduino-nightly\libraries\SoftwareSerial
exit status 1
'void pulseCounter()' redeclared as different kind of symbol

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

new_raw.ino (13.5 KB)

Again, we seem to be going around in circles.

In C/C++, you CANNOT define a function inside another function.

And you've got at least two - "SetSolinoidValve()" and "pulseCounter".

Please pay attention to placement of your { and }

Aren't these just the rudest of all posters. They just keep slamming you with error messages. They make no effort on their own, just take your changes and spit the errors back out at you. They don't even talk to you while they do it. They don't even bother with the posting guidelines about putting that stuff in code tags. They just post it like they think somebody owes them something.

Hey, look at the error codes. Do you not see that you now have two things with the same name? Can you not see how that might be a problem? Can you just put in a little bit of effort?

attachInterrupt(sensorInterrupt, pulseCounter, FALLING);
}
}

//Insterrupt Service Routine

void pulseCounter()
{
// Increment the pulse counter
pulseCount++;
}

instead of this..can we use

attachInterrupt(sensorInterrupt, pulseCount++, FALLING);

??

What did the compiler say when you tried it?

No. The second argument has to be a function that takes no arguments and returns void.

compiler moved to nxt error godd...

uint8_t getFingerprintEnroll() {

int p = -1;
Serial.print("Waiting for valid finger to enroll as #"); Serial.println(id);
lcd.setCursor(0, 1);
lcd.print(" ");

error: a function-definition is not allowed here before '{' token

Read my reply 21

And reply 11

error: a function-definition is not allowed here before '{' token

That's the one we've been trying to tell you about. Format your code and work out the braces. You got them all messed up.

Please read the forum guidelines and start posting code in code tags. Your continued refusal to play by the rules is not tolerable. Here I'll even link it out so you don't have to go looking for it since we can see just how lazy you are. "How to use this forum - please read"

Please read at least point 7 in that. Please do not continue to be so rude here.

okk got it..sorry if u feel that i am so rude..