Possibility to program the ATmega32u4 on the Arduino Yun using a configuration file 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)
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.