# Arduino code to send voltage, current and power to the things network with uplink

**URL:** <https://www.thethingsnetwork.org/forum/t/arduino-code-to-send-voltage-current-and-power-to-the-things-network-with-uplink/39130>\
**Category:** End Devices (Nodes)\
**Created:** [August 10, 2020, 10:47am UTC](https://www.thethingsnetwork.org/forum/t/arduino-code-to-send-voltage-current-and-power-to-the-things-network-with-uplink/39130 "2020-08-10T10:47:33Z")\
**Posts on this page:** 1\
**Showing post:** 22

<div class="post-metadata">

**Author:** ![arjanvanb](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/arjanvanb/32/46626_2.png) [@arjanvanb](https://www.thethingsnetwork.org/forum/u/arjanvanb)\
**Post date:** [August 11, 2020, 5:45pm UTC](https://www.thethingsnetwork.org/forum/t/arduino-code-to-send-voltage-current-and-power-to-the-things-network-with-uplink/39130/22 "2020-08-11T17:45:16Z")

</div>

> [@cherechi](#):
>
> I get 0 printed

Assuming TTN Console (or some gateway log) showed that a downlink should have been transmitted, you need to figure out why your device is not receiving it. You can start by adding the following to the `setup`, for example after the line for `LMIC_setDrTxpow`:

```cpp
// Make LMIC start its RX windows a bit earlier, and listen longer, to
// compensate for an inaccurate clock.
//
// Beware that a specific value may work for a slow data rate, but not
// for faster ones, and remember that RX1 may use different data rates
// than RX2. Like for some tests, RX2 in EU868 (using SF9) worked with
// the standard settings, but RX1 for SF8 needed 2%, while RX1 for SF7
// even needed 5% of the maximum error. For corrections exceeding 0.4%
// (0.4 / 100) this also needs LMIC_ENABLE_arbitrary_clock_error; see
// https://github.com/mcci-catena/arduino-LMIC/blob/master/README.md
LMIC_setClockError(MAX_CLOCK_ERROR * 5 / 100);

```

Be sure to read the link mentioned in the comment above; the example value of 5% is much higher than the 0.4% mentioned in [that documentation](https://github.com/mcci-catena/arduino-LMIC/blob/master/README.md#LMIC_setclockerror). So, you’ll need to set the compile-time flag `LMIC_ENABLE_arbitrary_clock_error`, or when using the Arduino editor, set the flag in the file Arduino/libraries/MCCI\_LoRaWAN\_LMIC\_library/project\_config/lmic\_project\_config.h

Also note the following comment in LMIC’s source code:

> <https://github.com/mcci-catena/arduino-lmic/blob/v3.2.0/src/lmic/lmic.h#L337-L348>

---

_[View the full topic](https://www.thethingsnetwork.org/forum/t/arduino-code-to-send-voltage-current-and-power-to-the-things-network-with-uplink/39130)._
