AMBIGUOUS ERROR????

#include <Wire.h>
#include <hd44780.h>                       // main hd44780 header
#include <hd44780ioClass/hd44780_I2Cexp.h> // i2c expander i/o class header

hd44780_I2Cexp lcd; // declare lcd object: auto locate & config exapander chip

// LCD geometry
const int LCD_COLS = 20;
const int LCD_ROWS = 4;
// lcd pins 20 & 21 - SDA, SCL)

// Buttons
const int resetButton = 4; // will reset all counts - (reset the syetem)
int resetbuttonState = 0; // variable for reading the reset button status

// variables
byte Pennies(); // how many pennies
byte Nickles(); // how many pennies
byte Dimes(); // how many pennies
byte Quarters(); // how many pennies
byte Coins(); // how many coins
byte TotalSaved(); // how much money saved

void setup() {
  // put your setup code here, to run once:

  int status;
  status = lcd.begin(LCD_COLS, LCD_ROWS);

 
  // call the main screen
  MainScreen();

  // initialize the reset button as an input:
  pinMode(resetButton, INPUT);


}

void loop() {
  // put your main code here, to run repeatedly:

  resetbuttonState = digitalRead(resetButton);
  // if the reset button is pressed
  if (resetbuttonState == HIGH) {
    // call resetSystem function
    resetSystem();
  }// end if resetbuttonState


}// end loop

void resetSystem() {
  lcd.clear();
  byte Pennies = 0; // set pennies count to 0
  byte Nickles = 0; // set nickles count to 0
  byte Dimes = 0; // aet dimes count to 0
  byte Quarters = 0; // set quarters count to 0
  byte Coins = 0; // set total coins to 0
  byte TotalSaved = 0; // set total amount saved to 0
  lcd.setCursor(0, 1);
  lcd.print("       System       ");
  lcd.setCursor(0, 2);
  lcd.print("       Reboot       ");
  delay(1000);
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Pennies:  ");
  lcd.print (Pennies);
  lcd.setCursor(0, 1);
  lcd.print("Nickles:  ");
  lcd.print (Nickles);
  lcd.setCursor(0, 2);
  lcd.print("Dimes:    ");
  lcd.print (Dimes);
  lcd.setCursor(0, 3);
  lcd.print("Quarters: ");
  lcd.print (Quarters);
  delay(1000);
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Total Coins:   ");
  lcd.setCursor(0, 1);
  lcd.print (Coins);
  lcd.setCursor(0, 2);
  lcd.print("Total Savings: ");
  lcd.setCursor(0, 3);
  lcd.print("$");
  lcd.print (TotalSaved); // WORKS FINE HERE
  delay(1000);
  lcd.clear();
  lcd.setCursor(0, 1);
  lcd.print("       Reboot       ");
  lcd.setCursor(0, 2);
  lcd.print("      Finished      ");
  delay(3000);
  MainScreen(); // call the main screen
}// end resetSystem

void MainScreen() {
  lcd.clear();
  lcd.setCursor(0, 1);
  lcd.print("  CURRENT SAVINGS:  ");
  lcd.setCursor(0, 2);
  lcd.print("$");
  lcd.print(TotalSaved); // AMBIGUOUS ERROR -- call of overloaded 'print(byte (&)())' is ambiguous
}// end main screen

just not understanding the error… if i RESET the TotalSaved and then later showed that it was set to 0, WHY won’t it print TotalSaved again if i know it can as i have done it exactly the same way in the reset??

What are you talking about? What error?

I notice you talking about your reset function so I looked for it. You are creating a bunch of new variables there, pennies, nickels etc. and setting them to 0.

You declared functions at the top called Pennies and Nickels etc, but you never implement the functions. You call them variables. But variables don't have parenthesis.

You got a bunch of stuff messed up. Why don't you slow down a little and start with what is this code supposed to do, what does it actually do, and how do those two things differ. You just kind of jumped off in the middle there like someone here would already know all about your project.

Oh, there's the error message, you put it in a comment. You made me hunt for it. That's not a good way to get help. You gotta make it easy to help you. Post that stuff separately and post the EXACT message. Don't paraphrase it unless you already know what is or is not important. And if you knew that you wouldn't be asking us. So just post the whole thing.

lcd.print(TotalSaved); // AMBIGUOUS ERROR -- call of overloaded 'print(byte (&)())' is ambiguous

This is calling print with the function pointer to TotalSaved function that you declared but never implemented. Again, I think you meant for that to be a variable. But variables don't have parenthesis.

byte TotalSaved(); // how much money saved

Maybe a good basic C++ tutorial, just the first bit, would do you a world of good. Learn what the parenthesis and brackets and stuff like that mean so you don't have to just guess.

#include <Wire.h>
#include <hd44780.h>                       // main hd44780 header
#include <hd44780ioClass/hd44780_I2Cexp.h> // i2c expander i/o class header

hd44780_I2Cexp lcd; // declare lcd object: auto locate & config exapander chip

// LCD geometry
const int LCD_COLS = 20;
const int LCD_ROWS = 4;
// lcd pins 20 & 21 - SDA, SCL)

// Buttons
const int resetButton = 4; // will reset all counts - (reset the syetem)
int resetbuttonState = 0; // variable for reading the reset button status

// variables
byte Pennies(); // how many pennies
byte Nickles(); // how many pennies
byte Dimes(); // how many pennies
byte Quarters(); // how many pennies
byte Coins(); // how many coins
byte TotalSaved; // how much money saved

void setup() {
  // put your setup code here, to run once:

  int status;
  status = lcd.begin(LCD_COLS, LCD_ROWS);


// impliment the variables
byte Pennies = 0;
byte Nickles = 0;
byte Dimes = 0;
byte Quarters= 0;
byte Coins = 0;
byte TotalSaved = 0;
  
  // call the main screen
  MainScreen();

  // initialize the reset button as an input:
  pinMode(resetButton, INPUT);


}

void loop() {
  // put your main code here, to run repeatedly:

  resetbuttonState = digitalRead(resetButton);
  // if the reset button is pressed
  if (resetbuttonState == HIGH) {
    // call resetSystem function
    resetSystem();
  }// end if resetbuttonState


}// end loop

void resetSystem() {
  lcd.clear();
  byte Pennies = 0; // set pennies count to 0
  byte Nickles = 0; // set nickles count to 0
  byte Dimes = 0; // aet dimes count to 0
  byte Quarters = 0; // set quarters count to 0
  byte Coins = 0; // set total coins to 0
  byte TotalSaved = 19; // set total amount saved to 0
  lcd.setCursor(0, 1);
  lcd.print("       System       ");
  lcd.setCursor(0, 2);
  lcd.print("       Reboot       ");
  delay(1000);
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Pennies:  ");
  lcd.print (Pennies);
  lcd.setCursor(0, 1);
  lcd.print("Nickles:  ");
  lcd.print (Nickles);
  lcd.setCursor(0, 2);
  lcd.print("Dimes:    ");
  lcd.print (Dimes);
  lcd.setCursor(0, 3);
  lcd.print("Quarters: ");
  lcd.print (Quarters);
  delay(1000);
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Total Coins:   ");
  lcd.setCursor(0, 1);
  lcd.print (Coins);
  lcd.setCursor(0, 2);
  lcd.print("Total Savings: ");
  lcd.setCursor(0, 3);
  lcd.print("$");
  lcd.print (TotalSaved);
  delay(1000);
  lcd.clear();
  lcd.setCursor(0, 1);
  lcd.print("       Reboot       ");
  lcd.setCursor(0, 2);
  lcd.print("      Finished      ");
  delay(3000);
  MainScreen(); // call the main screen
}// end resetSystem

void MainScreen() {
  lcd.clear();
  lcd.setCursor(0, 1);
  lcd.print("  CURRENT SAVINGS:  ");
  lcd.setCursor(0, 2);
  lcd.print("$");
  lcd.print(TotalSaved); // PRINTS a 0 instead of the 19 i set it to in the RESET
}// end main screen

ok, this has no error messages… however, it is displaying a 0 instead of the 19 i set the variable to in the reset…

@ Delta_G
basically this is to have 6 variables: Pennies, Nickles, Dimes, Quarters, Coins and TotalSaved. the reset button is to set those variables to 0 and then show the main screen showing:

CURRENT SAVINGS
$ AND TotalSaved variable

atm it should say 19 as i set it to in the reset for testing but instead shows a 0.

so it shows this:

CURRENT SAVINGS:
$0

when it should be showing:

CURRENT SAVINGS:
$19

if i’m doing something wrong, please show me a quick example of how i am supposed to do it

You really do need to do at least the first part of a basic C++ tutorial. That's you're whole problem is that you don't know the language basics. You could spend two hours on a good tutorial and fix your whole world.

But for the reason you see 0 is that you are creating new local variables with the same name as the global ones in the reset function. You set those local variables to 19, but that doesn't affect the global variable.

Having two variables in the same scope with the same name is just plain a bad idea. It's going to mess things up every time.

So in the reset function, remove the word "byte" so that you can use the variables you already have instead of creating new ones that cease to exist when that function ends.

void resetSystem() {
  lcd.clear();
  byte Pennies = 0; // set pennies count to 0
  byte Nickles = 0; // set nickles count to 0
  byte Dimes = 0; // aet dimes count to 0
  byte Quarters = 0; // set quarters count to 0
  byte Coins = 0; // set total coins to 0
  byte TotalSaved = 19; // set total amount saved to 0

Go here and work your way down to classes. I promise this will get you going a lot faster than just posting your error messages here and waiting for someone to give you a piece of a fix and posting more code with more errors. There are some fundamentals you need to understand.

in the reset function, remove the word "byte" so that you can use the variables you already have instead of creating new ones

thank you, that fixed the issue.. i didn't realize i was creating new variables.. and yes i will look into that

karma pt added :)

void MainScreen() {
  lcd.clear();
  lcd.setCursor(0, 1);
  lcd.print("  CURRENT SAVINGS:  ");
  lcd.setCursor(0, 2);
  lcd.print("$");
  lcd.print(TotalSaved); //???????
}// end main screen

also, how do i set commas and decimals in TotalSaved - so that it shows

CURRENT SAVINGS: $19.00

or say:

CURRENT SAVINGS: $1,000.00

First of all, totalSaved is a byte. So it will never get to 1000. It will count up to 255 and roll back over to 0.

But it's easy enough to print something after it. Just call print again.

lcd.print(totalSaved);
lcd.print(".00");

yeah but it needs to know when to put the commas and decimal.. not to be hard coded in like that..

It's a byte. It will always be ".00". You'll have to rewrite some code before you need to worry about the decimal part being anything else.

It's a byte, it can't be over 255. You got some work to do before you need to worry about commas.

so i would change BYTE to INT?

You got some work to do before you need to worry about commas.

so please show me

What did the lesson on datatypes say?

Ruffsta: so please show me

Show me what? Look, I help but you do the work.

Why are you suggesting int? Tell me about int. What can it do? What can it hold? Will that help?

I'm not saying it will or won't, I just can't stand people guessing. Go look in the reference at the data types you have available and pick one.

Delta_G:
Show me what? Look, I help but you do the work.

Why are you suggesting int? Tell me about int. What can it do? What can it hold? Will that help?

I’m not saying it will or won’t, I just can’t stand people guessing. Go look in the reference at the data types you have available and pick one.

cause int you can store a number between -32768 and 32767 in each element. but what if i wanted to go over 32,767?

i have no issue doing the work… but atleast tell me how i should set up the variable so i can use and show commas and decimal when they are needed… i have been doing the work… i provided the code i am working on… and it’s not like i want to learn arduino or c++ fluently when i only have a handful of projects i want to accomplish and then i’m pretty much done with arduino. arduino was supposed to be fun but the fun ran out a long time ago for me, but i still have these few projects i want to accomplish…

Ruffsta: i have no issue doing the work.. but atleast tell me how i should set up the variable so i can use and show commas and decimal when they are needed.. i have been doing the work.. i provided the code i am working on.. and it's not like i want to learn arduino or c++ fluently when i only have a handful of projects i want to accomplish and then i'm pretty much done with arduino. arduino was supposed to be fun but the fun ran out a long time ago for me, but i still have these few projects i want to accomplish..

If it isn't fun then stop. Just quit.

I'm not saying you're not doing the work. Just that I won't write it for you. I'll lead you there. But if you want me to just write it you gotta pay me. I get paid to write code. I help people write code for free. Which do you want?

Ruffsta: cause int you can store a number between -32768 and 32767 in each element. but what if i wanted to go over 32,767?

Good question. And another you can answer yourself if you take a quick look at the reference. Is there a data type that holds more than an int?

Will the value ever be negative? Is there anything to that?

OK, here’s another question for you while we’re at it.

Forget code for a second. We’re going to do math.

If I gave you the number 23456 (twenty three thousand four hundred and fifty six). Could you use math to isolate the part before and after the comma? What math operation could I use that would give me 23 as an answer? What math operation could I use that would give me the 456? Don’t forget to be looking at that reference section.

See, we’re getting to your comma.

Delta_G: Good question. And another you can answer yourself if you take a quick look at the reference. Is there a data type that holds more than an int?

Will the value ever be negative? Is there anything to that?

LONG seems to be the one i would want to use and no, the variable will never be negative. it will be 0 to say 1,000,000

for example: CURRENT SAVINGS: $0.00 ----- minimum with decimal

or

CURRENT SAVINGS: $1,000,000.00 ----- maximum with commas and decimal

OK, so we are still in a state where it will always be whole dollars no? Or do you want to measure in cents?