user37223: Is it possible to send a Configuration File viz. conf.json that can be sent to the Arduino Yun via Ethernet and a Python Program can parse the configuration and set for example Sampling Rate of a Sensor which is connected to the 32u4?
The problem for me is that Sampling Rate in the Arduino Sketch is actually a preprocessor directive and I understand that C++/Arduino Sketches need to be compiled once before the changes take place.
However, how can I change the preprocessor directive in the sketch using a configuration file?
e.g.
#define SAMPLE_RATE (100)

in a conf.json file somewhere there might be:
{"sample_rate": 1000}

Once the .json file is parsed using python is it possible to change
#define SAMPLE_RATE (100) // to #define SAMPLE_RATE (1000)


user4143: You can't. You'll have to change your macro into a variable and change that variable when suitable data is received through the serial port.
You may also have to trigger a reconfiguration of whatever software is doing the sampling, or reconfigure the hardware, depending on what it is you are sampling.

37223: <p>Is it possible to send a <strong>Configuration File</strong> viz. <code>conf.json</code> that can be sent to the Arduino Yun via Ethernet and a Python Program can parse the configuration and set for example <strong>Sampling Rate</strong> of a Sensor which is connected to the <strong>32u4</strong>?</p>

<p>The problem for me is that <strong>Sampling Rate</strong> in the Arduino Sketch is actually a preprocessor directive and I understand that C++/Arduino Sketches need to be compiled once before the changes take place.</p>

<p>However, how can I change the preprocessor directive in the sketch using a configuration file?</p>

<p><strong>e.g.</strong></p>

<pre><code>#define SAMPLE_RATE (100)
</code></pre>

<p>in a <code>conf.json</code> file somewhere there might be:</p>

<pre><code>{"sample_rate": 1000}
</code></pre>

<p>Once the <code>.json</code> file is parsed using python is it possible to change</p>

<pre><code>#define SAMPLE_RATE (100) // to #define SAMPLE_RATE (1000)
</code></pre>
 4143: <p>You can't. You'll have to change your macro into a variable and change that variable when suitable data is received through the serial port.</p>

<p>You may also have to trigger a reconfiguration of whatever software is doing the sampling, or reconfigure the hardware, depending on what it is you are sampling.</p>
