# How to I allow my variable to be used and have my Arduino execute automatically?

**URL:** <https://discourse.nodered.org/t/how-to-i-allow-my-variable-to-be-used-and-have-my-arduino-execute-automatically/70514>\
**Category:** General\
**Created:** [12 November 2022 20:19 UTC](https://discourse.nodered.org/t/how-to-i-allow-my-variable-to-be-used-and-have-my-arduino-execute-automatically/70514 "2022-11-12T20:19:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ceowens](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@Ceowens](https://discourse.nodered.org/u/Ceowens)\
**Post date:** [12 November 2022 20:19 UTC](https://discourse.nodered.org/t/how-to-i-allow-my-variable-to-be-used-and-have-my-arduino-execute-automatically/70514/1 "2022-11-12T20:19:23Z")

</div>

I calculated an updating theta value on my Raspberry Pi, I'm sending that over to another Raspberry Pi because of the distance my project requires via MQTT, and what I want to do is to be able to send that variable over to my Arduino to turn my stepper motor to that angle via a USB connection.

I have some simple small code on my Arduino already that takes a dummy variable to change the angle already and I'm almost done with my MQTT nodes.

_**What node(s) should I use to take in my variable from my Raspberry Pi, have it to be used by the Arduino, and then execute the Arduino code automatically?**_

This is the basic structure I have so far:

timestamp _--_

**exec** (My Python Script, while the command is running, spawn mode is enabled) _--_

change node (removes the string "Theta" that was shown in the original code (("Theta: " , theta))

debug

---

<div class="post-metadata">

**Author:** ![ScheepersJohan](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/scheepersjohan/32/39556_2.png) [@ScheepersJohan](https://discourse.nodered.org/u/ScheepersJohan)\
**Post date:** [12 November 2022 20:53 UTC](https://discourse.nodered.org/t/how-to-i-allow-my-variable-to-be-used-and-have-my-arduino-execute-automatically/70514/2 "2022-11-12T20:53:06Z")

</div>

> [@Ceowens](#):
>
> USB connection

The serial node

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [11 January 2023 20:53 UTC](https://discourse.nodered.org/t/how-to-i-allow-my-variable-to-be-used-and-have-my-arduino-execute-automatically/70514/3 "2023-01-11T20:53:46Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
