B4R Question Use Globalstore in inline C

hatzisn

Expert
Licensed User
Longtime User

Globalstore can be easily used from b4r. I tried to use it in in line C but I could not do it.
What I want to do is convert a number to char and add it in GlobalStore. Any help will be highly appreciated. Here is what I have got so far:

B4X:
#if C
void trial(B4R::Object* o) {
    ULong num = (o->toULong());
   
    char _texttodisplay;
    _texttodisplay = (char) num;
   
    B4R::B4RString _ttds;
    _ttds.wrap(&_texttodisplay);
   
    //This line does not work (it requires a B4R::Array*)
    //b4r_main::_globalstore->_put (2,(_ttds)->GetBytes());
}
#End If
 

hatzisn

Expert
Licensed User
Longtime User
I am trying to display native Greek Characters (like Γ-Gamma or Δ-Delta - Not common with english letters) in an LCD 1602 screen.

I have done it in tinkercad but I cannot transfer the code. Press the code button.

(Link is valid until 5/5/2021)

I was planning to pass the char to a slot and print it then with lcd.write(Globalstore.Slot0) - I thought (char) was casting to a character.

Edit - Would this be the answer?

B4X:
Private Sub PrintNativeGRLetter(num As UInt)
    Dim b As Byte = num
    lcd.Write(Array As Byte(b))
End Sub
 
Last edited:
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
Link does not work - wait a minute.

Edit - Ok it works now
 
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
The correct answer is as seen in the code in the end of post#1.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…