Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

graphSine.autoRescale(); CRASHES THE PROGRAM #2

Open
kotovasia5120 opened this issue Nov 24, 2024 · 4 comments
Open

graphSine.autoRescale(); CRASHES THE PROGRAM #2

kotovasia5120 opened this issue Nov 24, 2024 · 4 comments

Comments

@kotovasia5120
Copy link

when using graphSine.autoRescale(); the loop hangs.

@kotovasia5120
Copy link
Author

I tried pasting it in different places or writing the values ​​to the graph first. In any case, the code hung with this function without even writing the initial values.
https://gist.github.com/kotovasia5120/87a2b187a1446f73efd93f5bed40882e

@jgOhYeah
Copy link
Owner

Hi @kotovasia5120,
I've had a quick look at your code and have a few suggestions to try:

  • By default, the LCDGraph library communicates directly with the display using the built-in LiquidCrystal library (not using an I2C adaptor). To use the adaptor, an extra parameter in the template is required to specify the library to use:
    • Instead of LCDGraph<float> graphSine(4, 1, 0);, try LCDGraph<float, LiquidCrystal_I2C> graph(8, 0); or LCDGraph<float, LCD_I2C> graph(8, 0);
  • The I2C support in the LCGGraph library was written and tested using the LiquidCrystal_I2C library rather than the LCD_I2C library that this code uses. I'm not sure how compatible they are, but I would recommend switching to the LiquidCrystal_I2C library if the other one is not behaving as expected.
  • Try running / adapting sections of the I2CDisplay example as this will be relatively similar to what you are looking for.

I hope these are useful.

@kotovasia5120
Copy link
Author

@jgOhYeah
I tried to use the library you specified. It did not help the controller also in cyclic loading.
Maybe it is because I use platfomIO instead of arduino.
Or the liqudcrystal library is definitely needed. I changed the declaration of liquidcrystal in lcdGraph to liqudqrystal_I2C.
Also added the changes to the gist.

@jgOhYeah
Copy link
Owner

Modifying the LCDGraph.h file shouldn't be necessary when the second parameter in the template is given (like LCDGraph<float, LiquidCrystal_I2C> graphSine(8, 0);) as this just changes the default library used if the second parameter is not provided.

Does the I2CDisplay example work? If not, then:

  • Do any of the examples for the LiquidCrystal_I2C library show anything?
  • Is the display adaptor appearing at the correct I2C address and connected correctly? This can be checked by using one of the I2C scanner examples for the built-in wire library. I don't have an esp8266 on hand to test with, but the esp32 library calls this WireScan. I noticed the adaptor I was using the other day uses a different address to the one that I used previously.

If the I2CDisplay example works, then we know to have more of a look at your code. If it doesn't, then the issue likely lies in the physical wiring, I2C address chosen, LCDGraph library or LiquidCrystal_I2C library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants