For the second lab, we split our team in 2 groups. The first was on an Arduino board and the second was on a Raspberry PI. On the Arduino, we discovered the serial connection through some exercises. The serial connection is used to communicate with a computer thanks to his terminal. We learned to use analogic and digital inputs/outputs with push buttons, Leds, temperature sensor, potentiometer and switch.
This line set up the connection between the Arduino board and the computer with a Baudrate of 9600:
This line is writing whatever we want, and in this case, the temperature in the serial terminal on the computer.
Serial.println(“temperature: %d”, temp);
The second group worked with a Raspberry PI. As we didn’t have enough hdmi monitors for all groups, we remotely controlled the Raspberry using Putty (ssh protocol) and shell commands. The Raspberry PI was running on the Raspbian OS. Firstly, we began with some little exercises to handle basics shell commands:
- Cd + directory: change directory
- Mkdir + directory: create a directory
- Rmdir + directory: delete a directory
- Touch + filename: create an empty file
- VI + filename: open and edit a file
- Ls: display a list of existing files in the active directory
Secondly we started to use the GPIO to make a LED blink. Here is the code to make this possible:
import RPi.GPIO as GPIO
We didn’t use the gpiozero library because they weren’t installed on the SD card.
See you soon,
Guillaume, Mathieu, Vincent, Kevin