# Sending periodically sampled data through bluetooth uising Arduino Nano 33 ioT

**URL:** <https://forum.arduino.cc/t/sending-periodically-sampled-data-through-bluetooth-uising-arduino-nano-33-iot/1141063>\
**Category:** Nano 33 IoT\
**Created:** [June 23, 2023, 8:07pm UTC](https://forum.arduino.cc/t/sending-periodically-sampled-data-through-bluetooth-uising-arduino-nano-33-iot/1141063 "2023-06-23T20:07:24Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Klaus\_K](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/klaus_k/32/626942_2.png) [@Klaus\_K](https://forum.arduino.cc/u/Klaus_K)\
**Post date:** [July 21, 2023, 9:54pm UTC](https://forum.arduino.cc/t/sending-periodically-sampled-data-through-bluetooth-uising-arduino-nano-33-iot/1141063/2 "2023-07-21T21:54:54Z")

</div>

I would recommend to remove most code from the interrupt handler. Printing to serial and doing analogRead or are not a good idea in an ISR. Set a flag, leave the ISR and then control the rest from your main loop.

I also recommend you rewrite the main loop. Do not use while (central.connected()). Your loop should always run as fast/often as possible. That way you can add more functionality to your main loop without breaking it. Right now your main loop is no loop when you have a central connected to your peripheral.

Maybe the following example I wrote some time ago will give you some ideas. Reply #2

[https://forum.arduino.cc/t/bluetooth-communications/902610/2](https://forum.arduino.cc/t/bluetooth-communications/902610/2)

---

_[View the full topic](https://forum.arduino.cc/t/sending-periodically-sampled-data-through-bluetooth-uising-arduino-nano-33-iot/1141063)._
