We can start coding a basic Arduino-ROS node that can sense the amount of light using a light-dependent resistor (LDR). You can use any Arduino for this demo; here, we are going to use the Arduino Mega 2560. Given in the following figure is the circuit of an LDR with the Arduino. The characteristic of an LDR is that it is basically a resistor in which the resistance across it changes when light falls on it. The maximum resistance is when there is no light and minimum when light falls on it.
We have to connect one pin to 5V from the Arduino board and the next terminal ...