Go Down

Topic: delay and millis (Read 606 times) previous topic - next topic

lastchancename

Yeah - I was trying to illustrate that he could initialise them to whatever value he needed
Ask the right question, which can be hard for beginners, but this doesn't mean that google is broken.
Experienced responders have a nose for laziness, (they were beginners once)... expecting the poster to contribute to the learning experience.

psycho0

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.

cattledog

#17
Feb 25, 2018, 08:35 pm Last Edit: Feb 25, 2018, 08:36 pm by cattledog
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(). 

psycho0

#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.

CtrlAltElite

#19
Feb 25, 2018, 08:57 pm Last Edit: Feb 25, 2018, 09:00 pm by CtrlAltElite
Code: [Select]
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.
Has there been an outbreak of the stupid virus, and I didn't get the memo?

psycho0

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.

CtrlAltElite

#21
Feb 25, 2018, 09:08 pm Last Edit: Feb 25, 2018, 09:10 pm by CtrlAltElite
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 }
Has there been an outbreak of the stupid virus, and I didn't get the memo?

Delta_G

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?  
|| | ||| | || | ||  ~Woodstock

Please do not PM with technical questions or comments.  Keep Arduino stuff out on the boards where it belongs.

psycho0

attachInterrupt(sensorInterrupt, pulseCounter, FALLING);
 }
}

//Insterrupt Service Routine

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

instead of this..can we use

attachInterrupt(sensorInterrupt, pulseCount++, FALLING);


??

CtrlAltElite

What did the compiler say when you tried it?
Has there been an outbreak of the stupid virus, and I didn't get the memo?

Delta_G

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

Please do not PM with technical questions or comments.  Keep Arduino stuff out on the boards where it belongs.

psycho0

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

CtrlAltElite

#27
Feb 25, 2018, 09:18 pm Last Edit: Feb 25, 2018, 09:19 pm by CtrlAltElite
Read my reply 21

And reply 11
Has there been an outbreak of the stupid virus, and I didn't get the memo?

Delta_G

Code: [Select]
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.  
|| | ||| | || | ||  ~Woodstock

Please do not PM with technical questions or comments.  Keep Arduino stuff out on the boards where it belongs.

psycho0

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

Go Up