First, the first exercise was to build a circuit for reading a logical state and to display on the serial monitor. There was a simple switch that can block or allow the passage of current. In this way it was possible to pass the logic state from 0 to 1. Once the code builded, the serial monitor allowed to display the logic states through the following function: Serial.print (). Next, the code was modified in order to add a change of logical state in the monitor. This was possible thanks to conditions with the following function: if (). The last exercise was to see a LED with the features seen in the previous lab.
The second exercise is different because it does not have a stable condition. With the electronic of signal, it have to take account of disturbances which affect the result. To avoid this problem, a pull-up resistor is used because it allows to have a clear signal. For this, it is possible to use the internal circuit of the Arduino. The program is similar than the above because it display also the values in the serial monitor. However, the logic circuit is a little different from before: the function if () has been used several times used to perform the state change only when the button support.
The following exercise included a temperature sensor has to be sure to connect to the right way in order to avoid to destroy. Therefore, it is necessary refers to the datasheet. Reading of this sensor is done on the analog input A0. In order to display the actual temperature, a conversion is necessary by referring to the graph voltage / temperature of the datasheet. It is the same with the potentiometer where the maximum value is relieved and divide for a given between 1 and 0.
The last exercise concerns the k2000 connection. By performing a program and turning off/on the LEDs sequentially through delay. Using the connected potentiometer allows us to vary the intensity of the LEDs by reducing the amount of current passing through the LED. The push button powers LEDs through a test of the logic state of the push button from the start. Exercise 6 also allows us to send the scroll value of LEDs.