# Sending data to TTN

**URL:** <https://www.thethingsnetwork.org/forum/t/sending-data-to-ttn/48849>\
**Category:** Dragino\
**Created:** [June 16, 2021, 5:31pm UTC](https://www.thethingsnetwork.org/forum/t/sending-data-to-ttn/48849 "2021-06-16T17:31:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ProjetoFinal](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/projetofinal/32/35697_2.png) [@ProjetoFinal](https://www.thethingsnetwork.org/forum/u/ProjetoFinal)\
**Post date:** [June 16, 2021, 5:31pm UTC](https://www.thethingsnetwork.org/forum/t/sending-data-to-ttn/48849/1 "2021-06-16T17:31:23Z")

</div>

Hello everyone, trying to send data to TTN. Did so successfully using "mydata = “Hello World” ". Tried to send different values as in Humidity values and it just shows me

```
{
  "Text": "\u0000
}

```

in the Fields section in TTN Data.  
A portion of the code im using:

> // Prepare upstream data transmission at the next possible time.  
> // hum = dht.readHumidity();  
> // temp= dht.readTemperature();  
> mydata[0] = dht.readHumidity();  
> hum = dht.readHumidity();  
> Serial.print("Sizeof mydata - ");  
> Serial.println(sizeof(mydata));  
> Serial.print("Sizeof mydata[0] - ");  
> Serial.println(sizeof(mydata[0]));  
> LMIC\_setTxData2(1, mydata[0], sizeof(mydata[0]), 0);  
> Serial.println(F(“Packet queued”));  
> }

in that code, mydata[0] does store correctly the value for humidity so i dont know what im doing wrong now since im passing the values correctly through the function. Maybe something wrong with my decoder in TTN?

> function Decoder(bytes, port) {  
> return{  
> Text: String.fromCharCode.apply(null,bytes)  
> };  
> }

Thank you in advance if u reply

My best regards

Rodrigo Oliveira

---

<div class="post-metadata">

**Author:** ![descartes](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/descartes/32/47220_2.png) [@descartes](https://www.thethingsnetwork.org/forum/u/descartes)\
**Post date:** [June 16, 2021, 6:24pm UTC](https://www.thethingsnetwork.org/forum/t/sending-data-to-ttn/48849/2 "2021-06-16T18:24:06Z")

</div>

Bytes is an array of bytes, not a string or an individual character in ASCII

See [https://www.thethingsnetwork.org/docs/devices/bytes/](https://www.thethingsnetwork.org/docs/devices/bytes/)
