The PWM block generates square pulses of varying duty cycle depending on the input value sent to the block on the Arduino hardware pin.
.### Evaluating PostCodeGenCommand specified in the model ### Using toolchain: Arduino AVR v1.6.1 | gmake (64-bit Windows) ### 'E:\MATLAB_CD\S_Function_HC_SR_04\Test_SR04_PWM_ert_rtw\Test_SR04_PWM.mk' is up to date ### Building 'Test_SR04_PWM': C:\PROGRA~1\MATLAB\R2016a...
If we assume only a 1 byte buffer (the ATMEGA328 in the Arduino Uno has 2 bytes), then probably the easiest way to get interrupt-free serial communication working is to make a very simple protocol where every byte sent to the Arduino is acknowledged by a byte send by the Arduino. So ...
### Building 'Test_SR04_PWM': C:\PROGRA~1\MATLAB\R2016a\bin\win64\gmake -f Test_SR04_PWM.mk all g++ -fno-exceptions -fno-threadsafe-statics -c -g -w -ffunction-sections -fdata-sections -MMD -DARDUINO=10601 -MMD -MP -MF"RTGETINF.dep" -MT"RTGETINF.o" -Os -mmcu=atmega2560 ...