Platforms to show: All Mac Windows Linux Cross-Platform

Back to WiringPiMBS module.

WiringPiMBS.physPinToGpio(physPin 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 physical pin on the P1 connector.

WiringPiMBS.piBoardId(byref model as Integer, byref Rev as Integer, byref Mem as Integer, byref Maker as Integer, byref OverVolted 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
Queries board identifiers.

Mem is memory in Megabytes.
Maker, Model and Rev are value which match the constants in this module.

Some examples using this method:

WiringPiMBS.piBoardRev 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 board revision of the Raspberry Pi.

It will be either 1 or 2. Some of the BCM_GPIO pins changed number and function when moving from board revision 1 to 2, so if you are using BCM_GPIO pin numbers, then you need to be aware of the differences.

Some examples using this method:

WiringPiMBS.piHiPri(pri 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 attempts to shift your program (or thread in a multi-threaded program) to a higher priority and enables a real-time scheduling.

The priority parameter should be from 0 (the default) to 99 (the maximum). This won’t make your program go any faster, but it will give it a bigger slice of time when other programs are running. The priority parameter works relative to others – so you can make one program priority 1 and another priority 2 and it will have the same effect as setting one to 10 and the other to 90 (as long as no other programs are running with elevated priorities)

The return value is 0 for success and -1 for error. If an error is returned, the program should then consult the errno global variable, as per the usual conventions.

Note: Only programs running as root can change their priority. If called from a non-root program then nothing happens.

WiringPiMBS.piLock(Key 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
Locks a synchronization lock.

These allow you to synchronise variable updates from your main program to any threads running in your program. keyNum is a number from 0 to 3 and represents a “key”. When another process tries to lock the same key, it will be stalled until the first process has unlocked the same key.

You may need to use these functions to ensure that you get valid data when exchanging data between your main program and a thread – otherwise it’s possible that the thread could wake-up halfway during your data copy and change the data – so the data you end up copying is incomplete, or invalid.

WiringPiMBS.piMakerNames(index as Integer) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
Maps maker numbers to names.

Some examples using this method:

WiringPiMBS.piModelNames(index as Integer) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
Maps model numbers to names.

Some examples using this method:

WiringPiMBS.pinMode(pin as Integer, mode 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 sets the mode of a pin to either INPUT, OUTPUT, PWM_OUTPUT or GPIO_CLOCK.

Note that only wiringPi pin 1 (BCM_GPIO 18) supports PWM output and only wiringPi pin 7 (BCM_GPIO 4) supports CLOCK output modes.

This function has no effect when in Sys mode. If you need to change the pin mode, then you can do it with the gpio program in a script before you start your program.

WiringPiMBS.piRevisionNames(index as Integer) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method WiringPi MBS Linux Plugin 15.3 ❌ No ❌ No ✅ Yes ❌ No Desktop, Console & Web
Maps revision numbers to names.

Some examples using this method:

WiringPiMBS.piUnlock(Key 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
Unlocks a synchronization lock.

These allow you to synchronise variable updates from your main program to any threads running in your program. keyNum is a number from 0 to 3 and represents a “key”. When another process tries to lock the same key, it will be stalled until the first process has unlocked the same key.

You may need to use these functions to ensure that you get valid data when exchanging data between your main program and a thread – otherwise it’s possible that the thread could wake-up halfway during your data copy and change the data – so the data you end up copying is incomplete, or invalid.

WiringPiMBS.Processor(Index as Integer) as String   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 process name.

Looks up processor name in an array.
Index is 0 to 4.

WiringPiMBS.pullUpDnControl(pin as Integer, pud 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 sets the pull-up or pull-down resistor mode on the given pin, which should be set as an input.

Unlike the Arduino, the BCM2835 has both pull-up an down internal resistors. The parameter pud should be; kPUD_OFF, (no pull up/down), kPUD_DOWN (pull to ground) or kPUD_UP (pull to 3.3v) The internal pull up/down resistors have a value of approximately 50KΩ on the Raspberry Pi.

This function has no effect on the Raspberry Pi’s GPIO pins when in Sys mode. If you need to activate a pull-up/pull-down, then you can do it with the gpio program in a script before you start your program.

WiringPiMBS.pwmSetClock(divisor 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 sets the divisor for the PWM clock.

WiringPiMBS.pwmSetMode(mode 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
The PWM generator can run in 2 modes – “balanced” and “mark:space”.

The mark:space mode is traditional, however the default mode in the Pi is “balanced”. You can switch modes by supplying the parameter: kPWM_MODE_BAL or kPWM_MODE_MS.

WiringPiMBS.pwmSetRange(range 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 sets the range register in the PWM generator.

The default is 1024.

WiringPiMBS.pwmToneWrite(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 a tone.

WiringPiMBS.pwmWrite(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 to the PWM register for the given pin.

The Raspberry Pi has one on-board PWM pin, pin 1 (BMC_GPIO 18, Phys 12) and the range is 0-1024. Other PWM devices may have other PWM ranges.

This function is not able to control the Pi’s on-board PWM when in Sys mode.

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


The biggest plugin in space...