Author Topic: passing a string variable  (Read 894 times)

NigelWyborn

  • Newbie
  • *
  • Posts: 1
    • View Profile
passing a string variable
« on: February 16, 2018, 11:04:14 AM »
Hi,
Sorry for the daft question, however I cannot seem to pass a String variable to get printed to the Cleo35 screen. I am very new to C++, but have had decades of using PLC's and high level programming environments. Here is a simple sketch modified to show the issue I'm having.

#include <SPI.h>
#include <CleO.h>

void setup()
{
  String mystring ="my variable string";
  /* Initialize CleO - needs to be done only once */
  CleO.begin();
  CleO.DisplayRotate(2, 0);
    /* Set background color */
  CleO.SetBackgroundcolor(MEDIUMBLUE);
  /* Start building a screen frame */
  CleO.Start();
 CleO.StringExt(FONT_MEDIUM, 60, 35, WHITE, TL, 0, 0, "Length = 357mm");
  CleO.StringExt(FONT_MEDIUM, 60, 105, WHITE, TL, 0, 0, "Extension = 6.52mm");
   CleO.StringExt(FONT_MEDIUM, 60, 180, WHITE, TL, 0, 0, "Extension = 1.3%");
    CleO.StringExt(FONT_MEDIUM, 60, 255, WHITE, TL, 0, 0, mystring);


  /* Display completed screen frame */
  CleO.Show();
    CleO.Display(200);
}

void loop()
{
}

I have tried various permutations for the line     
CleO.StringExt(FONT_MEDIUM, 60, 255, WHITE, TL, 0, 0, mystring);

such as

    CleO.StringExt(FONT_MEDIUM, 60, 255, WHITE, TL, 0, 0, String (mystring));

But to no avail.

I know its daft, but Help Please?

CleOSupport

  • Administrator
  • Full Member
  • *****
  • Posts: 51
    • View Profile
Re: passing a string variable
« Reply #1 on: February 20, 2018, 12:56:13 PM »
Hello Nigel,

One way to make the string editable is to use it as a char array.

Code: [Select]
char CleoMessage[50];

void setup()
{
  CleO.begin();
  CleO.Start();
  strcat(CleoMessage, "123456"); // adding text to the empty array
  CleO.String(160, 240, CleoMessage);
   CleO.Show();
}

Alternatively, the Arduino IDE also has some conversions between string and other formats.


Code: [Select]
String message = "Hello";
char CleoMessage[50];

void setup()
{
  CleO.begin();
  CleO.Start();
  message.toCharArray(CleoMessage,50);
  CleO.String(160, 240, CleoMessage);
  CleO.Show();
}

Thanks,
CleO Support

MichaelHard

  • Full Member
  • ***
  • Posts: 4
    • View Profile
    • cenforce 200
Re: passing a string variable
« Reply #2 on: August 20, 2019, 01:05:05 PM »
We as a whole need to experience exciting affection making on ordinary everyday practice. Most by far of us have dreams to explore strong, electrifying, related, and enchanted suggestive lives. Unfortunately only one out of every odd one of us could value genuine in perspective on some or various reasons. The genuine reason found is erection failure. A complete target of intriguing act is to have peak. The two people do achieve this after finding much in physical love making. This can be possible exactly when male can have progressively advantageous erection using cenforce 200 mg.

https://www.unitymix.com/read-blog/14051
Visit more Products:--
cenforce 100
cenforce 150
fildena 100
vidalista 20
Kamagra 100