BeagleBone Black Programming using Matlab by Kurniawan Agus

BeagleBone Black Programming using Matlab by Kurniawan Agus

Author:Kurniawan, Agus
Language: eng
Format: epub
Publisher: PE Press
Published: 2015-10-13T16:00:00+00:00


We connect a LED on BeagleBone Black PWM pin on P9_14. The following is my hardware wiring.

4.3.2 Writing a Program

Now you can open MATLAB and write these scripts.

function [] = led_brightness() board = beaglebone(); PWM1A = 'P9_14'; finishup = onCleanup(@() exitprogram(board)); enablePWM(board,PWM1A); disp('press Ctr-C to exit'); while 1 for k = 0:0.3:3.3 writePWMVoltage(board,PWM1A,k); pause(1); end for k = 3.3:-0.3:0 writePWMVoltage(board,PWM1A,k); pause(1); end end end function exitprogram(b) clear b; disp('program has exit'); end



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.