array-gpio
Advanced tools
+1
-1
| { | ||
| "name": "array-gpio", | ||
| "version": "1.6.5", | ||
| "version": "1.6.6", | ||
| "description": "array-gpio is low-level javascript library for Raspberry Pi using direct register control.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
+22
-39
@@ -24,9 +24,2 @@ [](https://www.npmjs.com/package/array-gpio) | ||
| To check your RPI board pinout, enter *pinout* from a terminal. | ||
| ```console | ||
| $ pinout | ||
| ``` | ||
| All numbers in parenthesis are the pin numbers used on this module. | ||
| <br> | ||
@@ -43,8 +36,8 @@ | ||
| - [Creating a GPIO input and output object](#example-1) | ||
| - [Monitoring the state of an input object](#example-2) | ||
| - [Monitoring multiple input objects](#example-3) | ||
| - [Using *isOn* and *isOff* to get the current state of an input/output object](#example-4) | ||
| - [Turning *on* and *off* an output with a *delay*](#example-5) | ||
| - [Create an input/output array object](#example-6) | ||
| - [Create a simple output pulse](#example-7) | ||
| - [Monitoring the state of a GPIO input object](#example-2) | ||
| - [Monitoring multiple GPIO input objects](#example-3) | ||
| - [Using *isOn* and *isOff* to get the current state of a GPIO input/output object](#example-4) | ||
| - [Turning *on* and *off* a GPIO output with a *delay*](#example-5) | ||
| - [Create a GPIO input/output array object](#example-6) | ||
| - [Create a GPIO output pulse](#example-7) | ||
| 6. [API](#api) | ||
@@ -65,15 +58,8 @@ - [GPIO](#gpio) | ||
| ### Supported OS | ||
| Mostly tried and tested on the following Linux OS | ||
| - Raspberry Pi OS (32 and 64-bit) | ||
| - Raspbian | ||
| - Raspberry Pi OS (32 and 64-bit) | ||
| - 64-bit Ubuntu 20+ (Only GPIO peripheral is supported) | ||
| <br> | ||
| ### GPIO pin numbering | ||
| All pin numbering used on this module are based on the rpi board's pinout diagram *numbers 1~40*. <show a link to a pinout diagram> | ||
| <br> | ||
| ### Nodejs Requirements | ||
@@ -95,3 +81,3 @@ * Node.js version: 10.x, 12.x, 14.x, 16.x (Ideally, the latest LTS version) | ||
| Connect a momentary *switch button* on pin **11** and an *led* on pin **33**. | ||
|  | ||
|  | ||
@@ -146,3 +132,3 @@ Using **in** and **out** method from *array-gpio* object module | ||
| Connect momentary a *switch button* on pin **11, 13, 15** and **19** and an *led* on pin **33** and **35**. | ||
| Connect a momentary *switch button* on pin **11, 13, 15** and **19** and an *led* on pin **33** and **35**. | ||
| ```js | ||
@@ -155,10 +141,7 @@ const r = require('array-gpio'); | ||
| // Press sw1 to turn on the led1 | ||
| // Press sw2 to turn off the led1 | ||
| // Press sw1 to turn on led1, press sw2 to turn off led1 | ||
| // Press sw3 to turn on led2, press sw4 to turn off led2 | ||
| // Press sw3 to turn on the led2 | ||
| // Press sw4 to turn off the led2 | ||
| // The callback argument of .watchInput() method will be invoked if one of the input's pin state changes when pressing any of the input switches | ||
| // The callback argument will be invoked | ||
| // if you pressed any of the input switches | ||
| r.watchInput(() => { | ||
@@ -201,3 +184,3 @@ if(sw1.isOn){ | ||
| ## Example 5 | ||
| ### Turning on and off a GPIO output with a delay | ||
| ### Turning *on* and *off* a GPIO output with a *delay* | ||
@@ -228,3 +211,3 @@ Connect a momentary *switch button* on pin **11** and **13** and an *led* on pin **33**. | ||
| Connect a momentary switch button for each input pin and an led for each output pin. | ||
| Connect a momentary *switch button* for each input pin and an *led* for each output pin. | ||
|  | ||
@@ -237,3 +220,3 @@ ```js | ||
| // turn on the led's sequentially | ||
| // turn on all led outputs sequentially | ||
| let LedOn = () => { | ||
@@ -247,3 +230,3 @@ let t = 0; // initial on time delay in ms | ||
| // turn off the led's sequentially | ||
| // turn off all led outputs sequentially | ||
| let LedOff = () => { | ||
@@ -315,11 +298,11 @@ let t = 0; // initial off time delay in ms | ||
| watchInput(() => { | ||
| // press sw1 to pulse the led with a duration of 50 ms | ||
| // press sw1 to create a pulse with a duration of 50 ms | ||
| if(sw1.isOn){ | ||
| led.pulse(50); | ||
| } | ||
| // press sw2 to pulse the led with a duration of 200 ms | ||
| // press sw2 to create a pulse with a duration of 200 ms | ||
| else if(sw2.isOn){ | ||
| led.pulse(200); | ||
| } | ||
| // press sw3 to pulse the led with a duration of 1000 ms or 1 sec | ||
| // press sw3 to create a pulse with a duration of 1000 ms or 1 sec | ||
| else if(sw3.isOn){ | ||
@@ -335,3 +318,3 @@ led.pulse(1000); | ||
| To check your RPI board pinout, enter *pinout* from a terminal. | ||
| If you are using a *Raspberry Pi OS*, you can check your board's pinout by entering *pinout* from a terminal. | ||
| ```console | ||
@@ -351,3 +334,3 @@ $ pinout | ||
| Gets the current digital logical state of an input/output object during runtime. It is a getter only property. | ||
| Shows the current digital logical state of an input/output object during runtime. It is a getter only property. | ||
@@ -354,0 +337,0 @@ Returns *true* if the object logical state is *high* or *ON*. |
+12
-10
@@ -24,9 +24,9 @@ /* | ||
| /* The base addresses of each peripherals found on BCM2835 Arm Peripheral Manual */ | ||
| #define ST_BASE (peri_base + 0x3000) | ||
| #define CLK_BASE (peri_base + 0x101000) | ||
| #define GPIO_BASE (peri_base + 0x200000) | ||
| #define PWM_BASE (peri_base + 0x20C000) | ||
| #define SPI0_BASE (peri_base + 0x204000) | ||
| #define BSC0_BASE (peri_base + 0x205000) | ||
| #define BSC1_BASE (peri_base + 0x804000) | ||
| #define ST_BASE (peri_base + 0x3000) | ||
| #define CLK_BASE (peri_base + 0x101000) | ||
| #define GPIO_BASE (peri_base + 0x200000) | ||
| #define PWM_BASE (peri_base + 0x20C000) | ||
| #define SPI0_BASE (peri_base + 0x204000) | ||
| #define BSC0_BASE (peri_base + 0x205000) | ||
| #define BSC1_BASE (peri_base + 0x804000) | ||
@@ -173,5 +173,7 @@ /* Unused base addresses */ | ||
| else{ | ||
| //puts("Other Rpi Model"); | ||
| peri_base = 0xFE000000; | ||
| system_clock = 400000000; | ||
| //puts("Other Rpi Model"); | ||
| peri_base = 0x3F000000; | ||
| system_clock = 400000000; | ||
| //peri_base = 0xFE000000; | ||
| //system_clock = 400000000; | ||
| } | ||
@@ -178,0 +180,0 @@ |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
188968
-0.17%1462
-1.15%