Thanks to the first laboratory, we learned a little bit more on the Arduino board. We could use several functions on the Arduino to training ourselves to work with it.
First we began with application that allows us to play with a LED. We started to modify an example provided Arduino. We change the blinking using the delay function and then we experimented the PWM output available on the Arduino board. The AnalogWrite function let us define the average value of the PWM signal with an integer. With some loops and tests, it’s easy to generate typical signals like sawtooth and triangle function.
Then we made an application with a 7-segment display. The big default of this application that one segment requires his own digital output of the Arduino board. As we are on a low level of abstraction, programming a such display is time consuming and tedious.
After that we created a binary counter. This application was easy to realise because the arduino’s libraries own the bitRead function that allows us to know the state of each bit of the 2 bytes containing the integer. So we can define the state of the outputs.
To solve the issue about the number of outputs used by the 7-segment display, we are going to use a multiplexor. This component contains 8 channels and it’s possible to select one of them at the time. A binary code (3 bits) defines the selected channel. We save 4 digital outputs. If the switching frequency is enough high, we can see several segment switched on due to the retinal persistence.
Note: Don’t use digital outputs 0 and 1 (Rx/Tx) while uploading!
Guillaume, Mathieu, Vincent, Kevin