C/C++ Question BigNumbers Library need help

Discussion in 'Libraries developers questions' started by rwblinn, Jan 29, 2017.

  1. rwblinn

    rwblinn Well-Known Member Licensed User

    Hi,

    wrapping this library. rBigNumbers compiles without error, but when using
    Code:
    bn.Initialize(lcdbn)
    receiving error
    "can not cast type:{type=liquidcrystal_i2c,rank=0,remoteobject=true} to: {type=liquidcrystal_i2c,rank=0,remoteobject=true}"

    Seems that doing following in rBigNumbers.h & cpp is not correct:
    Code:
    void Initialize(LiquidCrystal_I2C* lcd);
    Code:
    void B4RBigNumbers_I2C::Initialize(LiquidCrystal_I2C* lcd) {
      bn = new (be) BigNumbers(&lcd);
      bn->begin();
    }
    Any help appreciated?

    Libary & Example code attached.
     

    Attached Files:

    • bn.zip
      File size:
      5.9 KB
      Views:
      138
  2. Erel

    Erel Administrator Staff Member Licensed User

    The type of lcd is B4RLiquidCrystal_I2C*.

    You can modify the rLiquidCrystal_I2C library and make lcd a public variable. Change your library code to accept a B4RLiquidCrystal_I2C* and get the native object with
    lcd->lcd
     
    rwblinn likes this.
  3. rwblinn

    rwblinn Well-Known Member Licensed User

    Thats it - need to polish the library up and will share rBigNumbers_I2C in the B4R Libraries.

    Thanks for your help.
     
  4. Alpandino

    Alpandino Member Licensed User

    Hi rwblinn, I'd need to view your rBigNumbers_I2C to understand how you resolved the issue. When can I find it?

    Thank you
     
  5. rwblinn

    rwblinn Well-Known Member Licensed User

    Please find attached the library rBigNumbers_I2C and modified rLiquidCrystal_I2C.

    Can not recall if I have made an example as haven't been using B4R for a while ... think I went to a non I2C solution at that time (see next).

    May be of interest, is a non I2C example for a LCD1602 to display big numbers (b4rhowtolcdbignumbers.zip).
     

    Attached Files:

    Johan Hormaza likes this.
  6. Alpandino

    Alpandino Member Licensed User

    Hi rwblinn, thank you a lot. :)
    Now what should I do to pass an array of lcd?
    I tried
    Code:
    void Initialize(ArrayB4RLiquidCrystal_I2C* lcd);
    an a many other things, but doesn't work, I receive different errors.
    Is it possible to pass in a method an array of a non-trivial type?
    I mean, I'm able to pass an array of Byte, an array of Int, and so on. But I can't pass an array of a type like lcd or AdafruitNeoPixel.

    Bye and thank
     
  7. rwblinn

    rwblinn Well-Known Member Licensed User

    Hi,

    afraid can not help further.

    Suggestion
    • create a new thread under B4R library questions related to wrapping the C library (you build)
    • share the B4R library code (and the C library with preferrable some examples) developed so far.
    May be someone else can help based on that information.

    Be aware that there is a AdafruitNeoPixel library.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice