<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>How to make led blinking only 5 times?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/86670/how-to-make-led-blinking-only-5-times</link><description>Hi, 
 I&amp;#39;m using the GPIO mode of CAF leds module to control led. 
 LED_EFFECT_LED_BLINK or LED_EFFECT_LED_BLINK2 macro can be used to set the effects of led. But the loop_forever which is a member in led_effect are all set to true, you can look here:</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 07 Apr 2022 01:29:37 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/86670/how-to-make-led-blinking-only-5-times" /><item><title>RE: How to make led blinking only 5 times?</title><link>https://devzone.nordicsemi.com/thread/362191?ContentTypeID=1</link><pubDate>Thu, 07 Apr 2022 01:29:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:db670e1a-a6c0-47f1-8d10-2413242db8ab</guid><dc:creator>Harvey Zheng</dc:creator><description>&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;I am not quite sure when the CAF LED module is used, but maybe it is necessary to allow the user to customize the number of&amp;nbsp;blink, because low-power products don&amp;#39;t blink all the time, j&lt;span&gt;ust a suggestion.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I tried to change the&amp;nbsp;&lt;strong&gt;LED_EFFECT_LED_BLINK2&lt;/strong&gt;, if I want to blink 5 times, I need to add five structures&amp;nbsp;of&amp;nbsp;led_effect_step such as below. It gets more complicated if you have more flashes.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define LED_EFFECT_LED_BLINK3(_period_on, _period_off, _color) \
    {                                                          \
        .steps      = ((const struct led_effect_step[]){       \
            {                                             \
                     .color         = _color,                  \
                     .substep_count = 1,                       \
                     .substep_time  = (_period_off ),           \
            },                                            \
            {                                             \
                     .color         = LED_NOCOLOR(),           \
                     .substep_count = 1,                       \
                     .substep_time  = ( _period_on),            \
            },                                            \
            {                                             \
                     .color         = _color,                  \
                     .substep_count = 1,                       \
                     .substep_time  = (_period_off ),           \
            },                                            \
            {                                             \
                     .color         = LED_NOCOLOR(),           \
                     .substep_count = 1,                       \
                     .substep_time  = ( _period_on),            \
            },                                            \
            {                                             \
                     .color         = _color,                  \
                     .substep_count = 1,                       \
                     .substep_time  = (_period_off ),           \
            },                                            \
            {                                             \
                     .color         = LED_NOCOLOR(),           \
                     .substep_count = 1,                       \
                     .substep_time  = ( _period_on),            \
            },                                            \
            {                                             \
                     .color         = _color,                  \
                     .substep_count = 1,                       \
                     .substep_time  = (_period_off ),           \
            },                                            \
            {                                             \
                     .color         = LED_NOCOLOR(),           \
                     .substep_count = 1,                       \
                     .substep_time  = ( _period_on),            \
            },                                            \
            {                                             \
                     .color         = _color,                  \
                     .substep_count = 1,                       \
                     .substep_time  = (_period_off ),           \
            },                                            \
            {                                             \
                     .color         = LED_NOCOLOR(),           \
                     .substep_count = 1,                       \
                     .substep_time  = ( _period_on),            \
            },                                            \
        }),                                               \
        .step_count = 10, .loop_forever = false,                 \
    }&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to make led blinking only 5 times?</title><link>https://devzone.nordicsemi.com/thread/362096?ContentTypeID=1</link><pubDate>Wed, 06 Apr 2022 13:00:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:45ee7398-f31e-4fa9-8622-15e16c35ac7d</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Can you provide some more information on what your end goal is here, as using the CAF module will be an over-complication if all you want to do is to blink a led 5 times. The&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/samples/basic/blinky/README.html"&gt; Blinky demo in Zephyr &lt;/a&gt;should be more than sufficient if you only need the Blinky functionality.&lt;/p&gt;
&lt;p&gt;If you need to use the CAF module, I think&amp;nbsp;the best way to go about this would be to make a copy of this LED_BLINK2 function and disable the loop_forever and instead set it to blink 5 times, and then call that function instead of the&amp;nbsp;&lt;strong&gt;LED_EFFECT_LED_BLINK2.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>