0

I have two functions that return an int16_t but I need to convert the ints to char* is for an attiny13

It would be something like this

const char* msg = "value1()"+','+"value2()"+','+"value3()"

like example

#include "TinyRF_TX.h"

void setup(){ // transmitter default pin is pin #2. You can change it by editing Settings.h setupTransmitter(); }

void loop(){

const char* msg = "Hello from far away!";

//send function accepts an array of bytes as first argument //second argument is the length of the array send((byte*)msg, strlen(msg));

//make sure there's at least a TX_DELAY_MICROS delay between transmissions //otherwise the receiver's behavior will be undefined delayMicroseconds(TX_DELAY_MICROS);

jota mauel
  • 11
  • 2

1 Answers1

3

You will need to build the string yourself. Probably the easiest way is using the sprintf() function which will take a bunch of arguments and convert them to a string based on formatting instructions you give it.

An apropos article here... https://www.programmingelectronics.com/sprintf-arduino/

bigjosh
  • 1,593
  • 10
  • 13