0

Take the example blink sketch, is it possible to set the LED-pin at compile time via command-line arguments or something similar?

In my actual sketch, I would like to set some variables (numbers, maybe strings).

The only thing I found so far is this StackOverflow question

https://arduino.stackexchange.com/questions/32519/environment-variable-to-change-build

(I use a Teensy 3.5, not an Arduino, if that makes any difference)

JavaMan
  • 1,142
  • 12
  • 22
  • "is it possible to set the LED-pin at compile time" Do you mean the pin number or the actual state of the pin? – Fitzi Aug 24 '19 at 14:25
  • this was just an example, in 'reality' i need to set a string, which I use as a filename for a file that will be saved on a Micro-SD card – JavaMan Aug 26 '19 at 05:50
  • Is there a specific reason you want to to this via compile-time constants? Otherwise I would suggest declaring the filename as `const char fileName[] = "myFile.txt"` somewhere on top of your sketch. – Fitzi Aug 26 '19 at 07:14
  • I've got around 50 devices, and each should have a different filename. I would like to write myself a script so that I don't have to change the file 50 times. (when I think about it again a number as parameter would be enough, I could then write a crude method which converts the number to the filename) – JavaMan Aug 26 '19 at 07:44

0 Answers0