Platforms to show: All Mac Windows Linux Cross-Platform

Back to WiringPiMBS module.

WiringPiMBS.analogRead(pin as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
This returns the value read on the supplied analog input pin.

You will need to register additional analog modules to enable this function for devices such as the Gertboard, quick2Wire analog board, etc.

WiringPiMBS.analogWrite(pin as Integer, value as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
This writes the given value to the supplied analog pin.

You will need to register additional analog modules to enable this function for devices such as the Gertboard.

WiringPiMBS.Board40Pin as Integer   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 25.5 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
Checks if the current Raspberry Pi model uses the 40-pin GPIO header.

Returns 1 if the board has a 40-pin header, 0 otherwise.

Added in WiringPi Interface v3.7.

WiringPiMBS.delay(HowLong as UInt32)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
This causes program execution to pause for at least howLong milliseconds.

Due to the multi-tasking nature of Linux it could be longer. Note that the maximum delay is an unsigned 32-bit integer or approximately 49 days.

WiringPiMBS.delayMicroseconds(HowLong as UInt32)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
This causes program execution to pause for at least howLong microseconds.

Due to the multi-tasking nature of Linux it could be longer. Note that the maximum delay is an unsigned 32-bit integer microseconds or approximately 71 minutes.

Delays under 100 microseconds are timed using a hard-coded loop continually polling the system time, Delays over 100 microseconds are done using the system nanosleep() function – You may need to consider the implications of very short delays on the overall performance of the system, especially if using threads.

WiringPiMBS.digitalRead(pin as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
This function returns the value read at the given pin.

It will be kHIGH or kLOW (1 or 0) depending on the logic level at the pin.

WiringPiMBS.digitalReadByte as Integer   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 25.5 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
Reads the state of the first 8 GPIO pins (0–7) and returns them as a bitfield.

Returns 8-bit value representing each pin’s digital level (1 = HIGH, 0 = LOW).

WiringPiMBS.digitalWrite(pin as Integer, value as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
Writes the value kHIGH or kLOW (1 or 0) to the given pin which must have been previously set as an output.

WiringPi treats any non-zero number as kHIGH, however 0 is the only representation of kLOW.

WiringPiMBS.digitalWriteByte(value as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
This writes the 8-bit byte supplied to the first 8 GPIO pins.

It’s the fastest way to set all 8 bits at once to a particular value, although it still takes two write operations to the Pi’s GPIO hardware.

WiringPiMBS.GlobalMemoryAccess as Integer   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 25.5 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
Checks whether WiringPi has access to the global /dev/mem memory interface, allowing unrestricted hardware control.

Return:
1 if full memory access is available (root or elevated privileges).
0 if restricted to user-level access (via /dev/gpiomem).
Version: Introduced in Interface v3.3.
Notes: Some advanced features (e.g., hardware PWM, clock outputs) require global access.

WiringPiMBS.gpioClockSet(pin as Integer, value as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
Sets the clock.

WiringPiMBS.GpioLayout as Integer   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 25.5 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
Returns the GPIO layout type of the Raspberry Pi board (e.g., revision 1, 2, 3, etc.).

Returns an integer identifying the board’s GPIO layout number (used internally to map pins).

This is the recommended way to determine board layout; supersedes piBoardRev().

WiringPiMBS.I2CRead(fd as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
Simple device read.

Some devices present data when you read them without having to do any register transactions.
If the return value is negative then an error has happened and you should consult errno.

WiringPiMBS.I2CReadReg16(fd as Integer, reg as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
Simple device read.

Some devices present data when you read them without having to do any register transactions.
Read a 16-bit value from the device register indicated.

If the return value is negative then an error has happened and you should consult errno.

WiringPiMBS.I2CReadReg8(fd as Integer, reg as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
Simple device read.

Some devices present data when you read them without having to do any register transactions.
Read an 8-bit value from the device register indicated.

If the return value is negative then an error has happened and you should consult errno.

WiringPiMBS.I2CSetup(devId as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
This initialises the I2C system with your given device identifier.

The ID is the I2C number of the device and you can use the i2cdetect program to find this out. I2CSetup() will work out which revision Raspberry Pi you have and open the appropriate device in /dev.

The return value is the standard Linux filehandle, or -1 if any error – in which case, you can consult errno as usual.

E.g. the popular MCP23017 GPIO expander is usually device Id 0x20, so this is the number you would pass into wiringPiI2CSetup().

WiringPiMBS.I2CSetupInterface(device as string, devId as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
This initialises the I2C system with your given device identifier and name.

WiringPiMBS.I2CWrite(fd as Integer, Data as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
Simple device write.

Some devices accept data this way without needing to access any internal registers.
If the return value is negative then an error has happened and you should consult errno.

WiringPiMBS.I2CWriteReg16(fd as Integer, reg as Integer, Data as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
Simple device write.

Some devices accept data this way without needing to access any internal registers.
Write a 16-bit data value into the device register indicated.

If the return value is negative then an error has happened and you should consult errno.

WiringPiMBS.I2CWriteReg8(fd as Integer, reg as Integer, Data as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
Simple device write.

Some devices accept data this way without needing to access any internal registers.
Write a 8-bit data value into the device register indicated.

If the return value is negative then an error has happened and you should consult errno.

WiringPiMBS.LoadLibrary(File as FolderItem) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
Loads the library.

Returns true on success or false on failure.
LoadError is set in case of failure.

See also:

WiringPiMBS.LoadLibrary(Path as string) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
Loads the library.

Returns true on success or false on failure.
LoadError is set in case of failure.

See also:

WiringPiMBS.MemorySize(Index as Integer) as Integer   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 25.5 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
Queries the memory sizes.

Looks up memory size in an array.
Index is 0 to 7.

WiringPiMBS.micros as UInt32

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
This returns a number representing the number of microseconds since your program called one of the wiringPiSetup functions.

It returns an unsigned 32-bit number which wraps after approximately 71 minutes.

Some examples using this method:

WiringPiMBS.millis as UInt32

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
This returns a number representing the number of milliseconds since your program called one of the wiringPiSetup functions.

It returns an unsigned 32-bit number which wraps after 49 days.

Some examples using this method:

WiringPiMBS.Read(fd as Integer, count as UInt64) as Memoryblock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
Read attempts to read count bytes of data from the object referenced by the descriptor fildes into a buffer.

Returns the memoryblock on success (if we got more than zero bytes).
Errno is set in case of error.

WiringPiMBS.RP1Model as Integer   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 25.5 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
Returns the Raspberry Pi RP1 I/O controller model version (used on Pi 5 and newer).

Return: Integer code identifying the RP1 revision.
Version: Added in WiringPi Interface v3.14.

WiringPiMBS.UserLevelAccess as Integer   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 25.5 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
The user level access.

Returns:
1 if running under /dev/gpiomem (non-root, limited hardware control).
0 if using full /dev/mem access.

Notes: Complements wiringPiGlobalMemoryAccess(); both indicate runtime privilege mode.

WiringPiMBS.Version(byref major as Integer, byref minor as Integer)   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 25.5 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
Retrieves the version number of the installed WiringPi library.

major: filled with the major version number.
minor: filled with the minor version number.

WiringPiMBS.wiringPiSetup as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
Initializes the library.

This initialises wiringPi and assumes that the calling program is going to be using the wiringPi pin numbering scheme. This is a simplified numbering scheme which provides a mapping from virtual pin numbers 0 through 16 to the real underlying Broadcom GPIO pin numbers. See the pins page for a table which maps the wiringPi pin number to the Broadcom GPIO pin number to the physical location on the edge connector.

This function needs to be called with root privileges.

One of the setup functions must be called at the start of your program or your program will fail to work correctly. You may experience symptoms from it simply not working to segfaults and timing issues.

WiringPiMBS.wiringPiSetupGpio as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
Initializes the library.

This is identical to wiringPiSetup, however it allows the calling programs to use the Broadcom GPIO pin numbers directly with no re-mapping.

As above, this function needs to be called with root privileges, and note that some pins are different from revision 1 to revision 2 boards.

One of the setup functions must be called at the start of your program or your program will fail to work correctly. You may experience symptoms from it simply not working to segfaults and timing issues.

WiringPiMBS.wiringPiSetupPhys as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
Initializes the library.

Identical to wiringPiSetup, however it allows the calling programs to use the physical pin numbers on the P1 connector only.

As above, this function needs to be called with root priviliges.

One of the setup functions must be called at the start of your program or your program will fail to work correctly. You may experience symptoms from it simply not working to segfaults and timing issues.

WiringPiMBS.wiringPiSetupSys as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
Initializes the library.

This initialises wiringPi but uses the /sys/class/gpio interface rather than accessing the hardware directly. This can be called as a non-root user provided the GPIO pins have been exported before-hand using the gpio program. Pin numbering in this mode is the native Broadcom GPIO numbers – the same as wiringPiSetupGpio() above, so be aware of the differences between Rev 1 and Rev 2 boards.

Note: In this mode you can only use the pins which have been exported via the /sys/class/gpio interface before you run your program. You can do this in a separate shell-script, or by using the system() function from inside your program to call the gpio program.

Also note that some functions have no effect when using this mode as they’re not currently possible to action unless called with root privileges. (although you can use system() to call gpio to set/change modes if needed)

One of the setup functions must be called at the start of your program or your program will fail to work correctly. You may experience symptoms from it simply not working to segfaults and timing issues.

Some examples using this method:

WiringPiMBS.wpiPinToGpio(wpiPin as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
This returns the BCM_GPIO pin number of the supplied wiringPi pin.

It takes the board revision into account.

WiringPiMBS.Write(fd as Integer, data as Memoryblock) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
Write to a file descriptor.

Write attempts to write bytes to the object referenced by the descriptor fildes from the memoryblock pointed to by data.
Upon successful completion the number of bytes which were written is returned. Otherwise, a -1 is returned and the global variable errno is set to indicate the error.

The items on this page are in the following plugins: MBS Linux Plugin.


The biggest plugin in space...