Each Raspberry hardware is running a different max version of Rasbian OS.
Raspberry Pi 3 is running on ARM71 and support "Raspbian GNU/Linux 8 (jessie)"
Install Git
Install Git ->
sudo apt-get install git-core
Which Hardware and Software Version you have
// Which Hardware Version$ cat /proc/cpuinfo// AT the end under Model, you have the version you run// Check the Software Version of Raspian you are running$ cat /etc/os-release// last version on 01/01/2021 -> v10, named buster// Check the processor architecture type on your Raspberry$ uname -m
$ sudo apt-get update && sudo apt-get upgrade
$ curl -fsSL https://get.docker.com -o get-docker.sh
$ sudo sh get-docker.sh
$ sudo usermod -aG docker pi
// Verify ok
$ docker info
// Run a first app:
$ docker run hello-world
First Docker App
!! The images from docker hub, please select on the left side the ARM64 tag. So when you build a docker image you have to take care of the end where it will run
The installation of Node.js depend of the Processor on the Raspberry Pi.
Installation on Raspberry Pi 4
! Be sure you have first upgraded to the latest Raspberry pi OS, otherwise you can have issue to support limited version of Node.js because of lib gcc++ incompatible used on old Raspberry pi OS.
$ curl -sL https://deb.nodesource.com/setup_15.x | sudo -E bash -
$ sudo apt install -y nodejs
$ sudo node -v
// npm is part of node so you should check you have it
$ npm -v
// if you don't have it, it means installation doesn happen on good way
// First program in hello.c#include <stdio.h>int main(){printf("Hello, World! \n");return0;}// Compile$ gcc hello.c -o helloTest$ chmod + helloTest// Run it$ ./helloTest
Library Wiring Pi: WiringPi is PRE-INSTALLED with standard Raspbian systems
//Create you nmp project//Install the on/off node module on project$ npm install onoff//create the index.js file with code to light GPIO 4var Gpio =require('onoff').Gpio; //include onoff to interact with the GPIOvarLED=newGpio(4,'out'); //use GPIO pin 4, and specify that it is outputvar blinkInterval =setInterval(blinkLED,250); //run the blinkLED function every 250msfunctionblinkLED() { //function to start blinkingif (LED.readSync() ===0) { //check the pin state, if the state is 0 (or off)LED.writeSync(1); //set pin state to 1 (turn LED on) } else {LED.writeSync(0); //set pin state to 0 (turn LED off) }}functionendBlink() { //function to stop blinkingclearInterval(blinkInterval); // Stop blink intervalsLED.writeSync(0); // Turn LED offLED.unexport(); // Unexport GPIO to free resources}setTimeout(endBlink,5000); //stop blinking after 5 seconds// Then you can run the project by$ node index.js
// create the index.js file to take input buton and light ledvar Gpio =require('onoff').Gpio; //include onoff to interact with the GPIOvarLED=newGpio(4,'out'); //use GPIO pin 4 as outputvar pushButton = new Gpio(17, 'in', 'both'); //use GPIO pin 17 as input, and 'both' button presses, and releases should be handled
pushButton.watch(function (err, value) { //Watch for hardware interrupts on pushButton GPIO, specify callback functionif (err) { //if an errorconsole.error('There was an error', err); //output error message to consolereturn; }LED.writeSync(value); //turn LED on or off depending on the button state (0 or 1)});functionunexportOnClose() { //function to run when exiting programLED.writeSync(0); // Turn LED offLED.unexport(); // Unexport LED GPIO to free resourcespushButton.unexport(); // Unexport Button GPIO to free resources};process.on('SIGINT', unexportOnClose); //function to run when user closes using ctrl+c
Based on Input Create a cryptographic key
var Gpio =require('onoff').Gpio; //include onoff to interact with the GPIOvarLED=newGpio(4,'out'); //use GPIO pin 4 as outputvar pushButton = new Gpio(17, 'in', 'both'); //use GPIO pin 17 as input, and 'both' button presses, and releases should be handled
pushButton.watch(function (err, value) { //Watch for hardware interrupts on pushButton GPIO, specify callback functionif (err) { //if an errorconsole.error('There was an error', err); //output error message to consolereturn; }LED.writeSync(value); //turn LED on or off depending on the button state (0 or 1)});functionunexportOnClose() { //function to run when exiting programLED.writeSync(0); // Turn LED offLED.unexport(); // Unexport LED GPIO to free resourcespushButton.unexport(); // Unexport Button GPIO to free resources};process.on('SIGINT', unexportOnClose); //function to run when user closes using ctrl+c