Most of these examples will be hardware control example’s following: Freenove Starter kit. But there will also be a section on self-hosting a website out of a raspberry pi.
The names of the sections here correspond to folders in the project space.
Inside the RaspberryPi I mkdir a directory called “Projects”, this is the root of my code. Projects has libs (which i download) and then proj_n which match the below projects. Each proj_n has a file called lang.txt which contains the language used to write this project.
Before every session we run:
sudo apt update && \
sudo apt upgradeRegarding GPIO visit this site for a mapping or on the pi run “gpio readall”, which can be done after the C step.
- Longer leg: +
- Shorter leg: -
- Diode, which only work if current is flowing in the correct direction: (Arrow with bar) positive going into arrow.
- Range Table:
LED Voltage Max Current Recommended Red 1.9-2.2V 20mA 10mA Green 2.9-3.4V 10mA 5mA Blue 2.9-3.4V 10mA 5mA
Represented with a squiggle. Remember V = IR “Voltage equals Current times Resistance”, Ohm’s law.
NEVER connect two poles (power/+ and GND/-) of a power supply with anything of low Resistance this will short the circuit, likely damaging everything.
Resistors are non-polar, so the orientation in a circuit does not matter.
How to use a breadboard or alternatively.
Breadboards are indexed by rows of numbers and columns of letters. They are connected with the relation: For each row grouped columns are connected, i.e. A-E and F-J are connected and for the Red/Blue lines the length tells how connected they are, they are not connected to the opposite side lines.
The buses/rails are detailed below: The blue (black sometimes) line is the ground / negative bus.
The red line is the positive, and any breaks indicate possible multiple voltage sources.
This library is required and for C can be found here. Within the Pi do:
git clone https://github.com/WiringPi/WiringPi.git
cd WiringPi
./build
# Test the installation
gpio -vAdditionally, you must adjust the Makefile to find WiringPi. Here is an example of adjusting the Makefile:
# Include the wiring Pi Lib
gcc ... -lwiringPi ...- GPIO Extension Shield and Cable
- BreadBoard
- LED
- 220
$Ω$ resistor (Red-Red-Black-Black-Brown) - 2 Wires
- The GPIO Extension((1..20dg))
- LED(+(27e),-(26e))
-
$220Ω$ (23a, 27a ~ 27e) - Wire(IO17/6b, 23b ~ 23a)
- Wire(GND/20c, 26c ~ -(26e))
In proj_1 run “make” then ./blink. Run make help for more options.