View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Raspberry Pi PWM Driver Block SFunction

Join the 15-year community celebration.

Play games and win prizes!

» Learn more

3.6
3.6 | 5 ratings Rate this file 24 Downloads (last 30 days) File Size: 17.9 KB File ID: #41529 Version: 1.2
image thumbnail

Raspberry Pi PWM Driver Block SFunction

by

 

29 Apr 2013 (Updated )

Simple Soft PWM driver block example using WirngPi

| Watch this File

File Information
Description

This is a simple example for motor speed control using the soft PWM function in the WiringPi library.
The range is set to 255 to emulate Arduino like implementation.
Other device driver block, and the hardware it was run on is available at our website:

http://minseg.webs.com/downloads

A complete Arduino library and curriculum is available here:
http://minseg.com/pages/downloads

coming soon:
- Quadrature Encoder
- MPU6050

and others!

This work is part of the Mechatronics curriculum at Rensselaer Polytechnic Institute.

Acknowledgements

Device Drivers inspired this file.

This file inspired Raspberry Pi Simulink Driver Blocks Adc Dac Pwm.

Required Products Simulink
Target Support Package
MATLAB
MATLAB release MATLAB 8.1 (R2013a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (7)
24 Apr 2016 Miguel

Miguel (view profile)

 
26 Mar 2016 Arnaldo Ferreira de Oliveira Junior  
11 Jun 2015 John Whittington

The errors you are having are as the error explains: The GPIO block is set to 'Model B' by default, most Pis are now 'Model B+'. Open the 'GPIO Write' block and change the 'Board' parameter to 'Model B+'.

There are bigger issues with this example though. The includes in 'Code Generation > Custom Code' need removing as they look within the local system. Additionally the wiringPi library needs adding to the linker flags using 'xmakefilesetup' - see my blog: http://wp.me/p2C0Bi-bK

08 May 2015 Walter Veiga

HI,
I'm having the same problem, did you manage to fix this?

Comment only
09 Apr 2015 Mark Laszlo

Hey guys,
I’m trying to use this PWM_Out_SFunction_Example for Raspberry Pi, but uunfortunately I can not. I’ve already tried on both R2013b and R2015a (using RPi Model B+), but it always gives me this problem: Error in S-function 'PWM_Out_SFunction_Example/Soft PWM Output SFunction': S-Function 'sfcn_PWM_Out' does not exist
And the command windows gives this error: Warning: The Board parameter in 'PWM_Out_SFunction_Example/GPIO Write' block does not match the board at '169.254.0.2'.
I checked the wiringPi library on the Pi and it contains all the necessary files, so I have no idea what is the problem … 
Could you help me with this issue?

Comment only
13 Nov 2014 Carlos Moran  
03 Jul 2013 Paul Kassebaum  
Updates
21 Aug 2014 1.1

updated links

22 Aug 2014 1.2

updated links

Contact us