# What program is my Arduino currently running

**URL:** <https://forum.arduino.cc/t/what-program-is-my-arduino-currently-running/1010639>\
**Category:** Programming\
**Created:** [July 8, 2022, 5:50pm UTC](https://forum.arduino.cc/t/what-program-is-my-arduino-currently-running/1010639 "2022-07-08T17:50:10Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![fantafauna](https://avatars.discourse-cdn.com/v4/letter/f/f0a364/32.png) [@fantafauna](https://forum.arduino.cc/u/fantafauna)\
**Post date:** [July 8, 2022, 5:50pm UTC](https://forum.arduino.cc/t/what-program-is-my-arduino-currently-running/1010639/1 "2022-07-08T17:50:10Z")

</div>

My arduino is doing stuff and i can control my servos with the potentiometer. I have written a few sketches. I closed all sketch windwos. Has anyone an idea how to find out which program my Arduino currently is running?

Thank you very much  
Fanta

---

<div class="post-metadata">

**Author:** ![paulpaulson](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/paulpaulson/32/363643_2.png) [@paulpaulson](https://forum.arduino.cc/u/paulpaulson)\
**Post date:** [July 8, 2022, 6:00pm UTC](https://forum.arduino.cc/t/what-program-is-my-arduino-currently-running/1010639/3 "2022-07-08T18:00:17Z")

</div>

Hello [fantafauna](https://forum.arduino.cc/u/fantafauna)  
Take a view into the sketch book to be found inside the IDE.

Inside the sketch I´m using the following lines of code:

```cpp
Serial.begin(9600);
  Serial.print("File: ");
  Serial.println( __FILE__ );
  Serial.print("Projekt: ");
  Serial.println("myProject");

```

---

<div class="post-metadata">

**Author:** ![b707](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/b707/32/854321_2.png) [@b707](https://forum.arduino.cc/u/b707)\
**Post date:** [July 8, 2022, 6:00pm UTC](https://forum.arduino.cc/t/what-program-is-my-arduino-currently-running/1010639/4 "2022-07-08T18:00:24Z")

</div>

It;s impossible to read sourcecode back from the controller, that you cant download the program and directly compare it with saved sketches. But you can download the binary code and compare it with ones, produced by compiler.

---

<div class="post-metadata">

**Author:** ![fantafauna](https://avatars.discourse-cdn.com/v4/letter/f/f0a364/32.png) [@fantafauna](https://forum.arduino.cc/u/fantafauna)\
**Post date:** [July 8, 2022, 6:18pm UTC](https://forum.arduino.cc/t/what-program-is-my-arduino-currently-running/1010639/5 "2022-07-08T18:18:10Z")

</div>

okay but then i have to now which sketch it is running right now, to write that into the sketch. but yes i also thought of serial monitor - thank you 🙂

---

<div class="post-metadata">

**Author:** ![gcjr](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/gcjr/32/314015_2.png) [@gcjr](https://forum.arduino.cc/u/gcjr)\
**Post date:** [July 8, 2022, 6:20pm UTC](https://forum.arduino.cc/t/what-program-is-my-arduino-currently-running/1010639/6 "2022-07-08T18:20:34Z")

</div>

have you tried looking at the serial monitor to see if it prints anything? try different bit rates

---

<div class="post-metadata">

**Author:** ![StefanL38](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/stefanl38/32/713548_2.png) [@StefanL38](https://forum.arduino.cc/u/StefanL38)\
**Post date:** [July 8, 2022, 6:49pm UTC](https://forum.arduino.cc/t/what-program-is-my-arduino-currently-running/1010639/7 "2022-07-08T18:49:47Z")

</div>

compiling and uploading a sketch creates multiple files  
You can lookup these files and look at the last changed timestamp  
 ![grafik](https://europe1.discourse-cdn.com/arduino/original/4X/7/0/7/707dc23d75dc28ee3028f570490ba7e1f95727ae.png)

If you have done a lot of compilings after the one you are interested in.  
Always add something like this to **all** your sketches

```cpp
void PrintFileNameDateTime() {
  Serial.println( F("Code running comes from file ") );
  Serial.println( F( __FILE__ ) );
  Serial.print( F(" compiled ") );
  Serial.print( F( __DATE__ ) );
  Serial.print( F(" ") );
  Serial.println( F( __TIME__ ) );  
}

```

best regards Stefan

---

<div class="post-metadata">

**Author:** ![pmagowan](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@pmagowan](https://forum.arduino.cc/u/pmagowan)\
**Post date:** [July 8, 2022, 7:06pm UTC](https://forum.arduino.cc/t/what-program-is-my-arduino-currently-running/1010639/8 "2022-07-08T19:06:33Z")

</div>

That’s a good point. Perhaps we should all be putting a serial print in out setup just to let us know which sketch version we are using.

---

<div class="post-metadata">

**Author:** ![wildbill](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/wildbill/32/1126438_2.png) [@wildbill](https://forum.arduino.cc/u/wildbill)\
**Post date:** [July 8, 2022, 8:34pm UTC](https://forum.arduino.cc/t/what-program-is-my-arduino-currently-running/1010639/9 "2022-07-08T20:34:55Z")

</div>

It is indeed a good idea to identify the sketch via the serial port as a check, but if you didn't and don't know what you have, what do you care? Just burn the sketch you want to the Arduino and move on.

---

<div class="post-metadata">

**Author:** ![cedarlakeinstruments](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/cedarlakeinstruments/32/1128931_2.png) [@cedarlakeinstruments](https://forum.arduino.cc/u/cedarlakeinstruments)\
**Post date:** [July 9, 2022, 2:53pm UTC](https://forum.arduino.cc/t/what-program-is-my-arduino-currently-running/1010639/10 "2022-07-09T14:53:51Z")

</div>

This "problem" is why every Arduino program I write starts by outputting the program name and version to the serial port 🙂

---

<div class="post-metadata">

**Author:** ![paulpaulson](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/paulpaulson/32/363643_2.png) [@paulpaulson](https://forum.arduino.cc/u/paulpaulson)\
**Post date:** [July 9, 2022, 3:05pm UTC](https://forum.arduino.cc/t/what-program-is-my-arduino-currently-running/1010639/11 "2022-07-09T15:05:26Z")

</div>

plus path to source code.

---

<div class="post-metadata">

**Author:** ![sterretje](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sterretje/32/391294_2.png) [@sterretje](https://forum.arduino.cc/u/sterretje)\
**Post date:** [July 9, 2022, 3:32pm UTC](https://forum.arduino.cc/t/what-program-is-my-arduino-currently-running/1010639/12 "2022-07-09T15:32:59Z")

</div>

> [@pmagowan](#):
>
> serial print in out setup

Bad idea if you use boards with native USB 😉 To see it, you need `while(!Serial)` in setup() which will block if you don't connect your board to a PC **and** open a terminal program; not all programs need that terminal program (or even a PC).

Alternatively, one can use print in loop() but that might have unwanted side affects if you don't take precautions; your sketch might become very sluggish.

---

<div class="post-metadata">

**Author:** ![StefanL38](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/stefanl38/32/713548_2.png) [@StefanL38](https://forum.arduino.cc/u/StefanL38)\
**Post date:** [July 9, 2022, 4:58pm UTC](https://forum.arduino.cc/t/what-program-is-my-arduino-currently-running/1010639/13 "2022-07-09T16:58:56Z")

</div>

> [@sterretje](#):
>
> Bad idea if you use boards with native USB 😉 To see it, you need `while(!Serial)` in setup() which will block if you don't connect your board to a PC **and** open a terminal program; not all programs need that terminal program (or even a PC).

To solve this problem an IO-pin could be configured as input\_pullup and only if this IO-pin goes low print the source-code-information.  
best regards Stefan

---

<div class="post-metadata">

**Author:** ![cedarlakeinstruments](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/cedarlakeinstruments/32/1128931_2.png) [@cedarlakeinstruments](https://forum.arduino.cc/u/cedarlakeinstruments)\
**Post date:** [July 10, 2022, 4:58pm UTC](https://forum.arduino.cc/t/what-program-is-my-arduino-currently-running/1010639/14 "2022-07-10T16:58:44Z")

</div>

> [@paulpaulson](#):
>
> plus path to source code.

Good idea! Never thought of that.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [January 6, 2023, 4:59pm UTC](https://forum.arduino.cc/t/what-program-is-my-arduino-currently-running/1010639/15 "2023-01-06T16:59:28Z")

</div>

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