Convert int to string / char Arrays


hi there!
i using virtual wire + attiny 85 send data on rf link gets received arduino uno.
if use standard example everythink works fine, , sends every string want.

but want able send changing string , numbers (int?); e.g. sensor data, counters, ...
i program (mostly java atm) , learned c++ years ago here confused...

they convert string array of chars , send them. tried dublicate creating own array , trying things
code: [select]
char *myarray;
myarray[0] = i; // = counter

but nothing reaches receiver.
how send numbers , changing stuff?

code: [select]

// transmitter.pde
//
// simple example of how use virtualwire transmit messages
// implements simplex (one-way) transmitter tx-c1 module
//
// see virtualwire.h detailed api docs
// author: mike mccauley (mikem@open.com.au)
// copyright (c) 2008 mike mccauley
// $id: transmitter.pde,v 1.3 2009/03/30 00:07:24 mikem exp $

#include <virtualwire.h>

void setup()
{
   // initialise io , isr
   vw_set_tx_pin(3);
   vw_set_ptt_inverted(true); // required dr3100
   vw_setup(2000); // bits per sec
}

void loop()
{
   const char *msg = "hello";

   vw_send((uint8_t *)msg, strlen(msg));
   vw_wait_tx(); // wait until whole message gone
   
   delay(200);
}

not sure if sprintf works on tiny85


Arduino Forum > Using Arduino > Programming Questions > Convert int to string / char Arrays


arduino

Comments

Popular posts from this blog

Convierte tu Raspberry en un NAS. Firmware fvdw-sl 15.3 - Raspberry Pi Forums

How to format a Get Request

avrdude: verification error, first mismatch at byte 0x0000 0x0c != 0x62