Scenes: How to set LED brightness values in different scenes for SoulissApp ?

383 views
Skip to first unread message

Niels

unread,
Aug 23, 2015, 8:06:18 AM8/23/15
to souliss

Typical T_19 - How to set brightness values in different scenes ?



Hi there all

After getting much more familiar with Souliss and its hardware, I recently ran into a software related SoulissApp task I got stuck with for a while now. Maybe someone has a smart idea how to solve this - or this has even been a problem in the past which has already been solved.

Hardware: Arduino Mega2560 - Android SoulissApp

Basis: using typical T_19 (on sketch in Mega) to dim a LED-strip (via SoulissApp) . The basic functions (hardware / software) are working all perfect so far.

Task: Creating multiple scenes on Souliss App that define independently a certain level of brightness (given range: 0 - 255) to dim/regulate a given single LED-strip.

Problem: During the scene-creating-process in the App, there are 3 predefined commands  ON, OFF, toggle (they all work fine). Nevertheless, setting a brightness value is not possible.

I wonder if there is a possibility to include a specific LED brightness value, that is valid for each scene independently. E.g. scene1 generates min. brightness (like 1 out of 255) for the LED strip. Scene2 generates medium brightness (like 150 out of 255) and scene3 generates max. brightness on the given LED strip. All three scenes are related to the same LED strip of course.

I found the #define Souliss_T1n_Set command in the T_19 documentation. But I'm not sure if this is helpful here and neither how to implement it properly into my sketch,


I'd be very thankful for all help and/or example sketches how to implement brightness values into different scenes!

So many thanks in advance,

Niels


Di Maio, Dario

unread,
Aug 23, 2015, 9:52:42 AM8/23/15
to sou...@googlegroups.com
Hi Niels,

you should build a a Typical 14 : Pulse Digital Output and use it to force the brightness value that you wish.
Your sketch will look like
Logic_T14(slot)
if(mOutput(slot)){
mInput(slot_led_light+1) = 100; //brightness
mInput(slot_led_light)= Souliss_T1n_Set;
}

Some reference,
Dario.

--
You received this message because you are subscribed to the Google Groups "souliss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to souliss+u...@googlegroups.com.
To post to this group, send email to sou...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/souliss/c2c5e8f6-1515-4010-afcc-1e0abc63b833%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Niels

unread,
Aug 23, 2015, 3:10:54 PM8/23/15
to souliss

Oh I see  -

Thanks Dario for your quick support - I'll try your suggestions asap.

I'm curious about how this will work out for me !!

My feedback will follow soon -
Message has been deleted
Message has been deleted

Niels

unread,
Aug 26, 2015, 9:06:31 AM8/26/15
to souliss
Dear Dario

I spent some time on testing particular code alternatives (trial'n error) with reference to your suggested T14-PWM -solution (pls. find above). As a beginner I also used the NodoSoulis-Tool and it could really sort out some basic problems for me! Nice feature.

For now, I could implement your suggestions into the code and it's working as described ( by forcing a specific brightness value) - a given brightness intensity can be set via code and is being activated via SoulissApp. This is a kind of 'work around' for me, that will fit my desired planning good. Thanks so far!!

Nevertheless at this point I assume, there is no possibility to define multiple LED-brightness values via App and in addition, integrate these values permanently into different Scenes. I guess this would require a T14-like typical, that allows to input values not via code, but via typical/App and store these values permanently.

If there might be such a typical (or a typical to be used like this) I'd be happy to hear about - if not, no problem at all, I'm still happy at this point with Souliss!   ;))

Best regards, Niels


Di Maio, Dario

unread,
Aug 26, 2015, 2:39:31 PM8/26/15
to sou...@googlegroups.com
Hi Niels,

there are just three small errors:
2) You should read the output of T14 and use it to control T19
3) You can never use two typicals on the same slot.

So,

#define LEDCONTROL       0               // This is the memory slot for the logic that handle the light
#define LED                      2               // This is the memory slot for the logic that handle the light

void setup()
{   
    
Initialize();
   
// Set network parameters
   
SetAddress(0xD002, 0xFF00, 0xD001);

    
Set_T19(LEDCONTROL);                  // Set a logic to control a single colour LED strip
    
Set_T14(LED);                  // Set a logic to control a single colour LED strip
   
    
// Define inputs, outputs pins
    pinMode
(2, INPUT);                  // Hardware pulldown (R1: GND - 10k - Pins2) required
    pinMode
(13, OUTPUT);             // Power the Arduino-onboard-LED
}
void loop()
{ 
    
// Here we start to play
    EXECUTEFAST
() {                     
        UPDATEFAST
();   

        
// Execute the code every 1 time_base_fast      
        FAST_10ms
() {
        
            
// Use Pin2 as ON/OFF command, use a pulldown resistor (10 k) connected between 
            
// Pin2 and GND. Pressing for more than 1,5 seconds will set the GoodNight mode
            
// and the light will be progressly be turned off.
            
// It get the digital input state and store it in the LEDCONTROL logic
            DigIn(2, Souliss_T1n_ToggleCmd, LEDCONTROL);        
            
            
// Execute the logic that handle the LED
            Logic_T14(LED);
            Logic_T19(LEDCONTROL);

            
if(mOutput(LED)){
                                    mInput
(LEDCONTROL+1) = 100;               //brightness
                                    mInput
(LEDCONTROL)= Souliss_T1n_Set;
                                   
}
            
// Use the output values to control the strip
            analogWrite
(13, mOutput(LEDCONTROL));

            
// Just process communication as fast as the logics
            
ProcessCommunication();
        
}           
    
}
    EXECUTESLOW
()
    
{   
        UPDATESLOW
();

        SLOW_10s
()  {
        
            
// The timer handle timed-on states
            
// Timer_T14(LEDCONTROL);                        
        
}     
    
}       
}

Let me know,
Dario.

On Tue, Aug 25, 2015 at 7:27 PM, Niels <niels.c...@gmail.com> wrote:
Dear Dario

I spent some time testing particular codes (trial'n error) with reference to your suggested T14-PWM -solution (pls. find above). As a beginner I think I have to sort out some particulars 1st to become more successful with my desired results ;)

(basic information: all tests have run through a routine as: 'drop DB' > restart soulissApp > 'get souliss nodes'. This is to prevent soulissApp errors and work with a fully renewed DB each time testing a modified sketch!)


My first question would be: I assume you suggested to add the T14-typical to my existing sketch - not to replace the T19-typical by T14. Pls could you confirm.

The 2nd question is: I assumed to find an option like 'set value (0-255)' using the T14-PWM-typical in soulissApp. Instead there was offered an 'OPEN' switch in the App. Does your T14-suggestion include a soulissApp related PWM-setting of brightness, or is this just code related (as in your sketch
mInput(slot_led_light+1) = 100; //brightness
from which 100 would be a fixed brightness value) ?

Initially I've used the e03_RGBstrip example, modified it and replaced the relevant codes by the T19 typical (single LEDstrip). After my T14-testing I could only use the T14-typical 'open command' in soulissApp to turn on the test LED (Pin13) - no brightness variation possible.. The relevant part of my current sketch looks like

#define LEDCONTROL       0               // This is the memory slot for the logic that handle the light
#define LED                      1               // This is the memory slot for the logic that handle the light

void setup()
{  
   
Initialize();
   
// Set network parameters
   
SetAddress(0xD002, 0xFF00, 0xD001);

   
Set_T19(LEDCONTROL);                  // Set a logic to control a single colour LED strip
   
Set_T14(LEDCONTROL);                  // Set a logic to control a single colour LED strip
   
   
// Define inputs, outputs pins
    pinMode
(2, INPUT);                  // Hardware pulldown (R1: GND - 10k - Pins2) required
    pinMode
(13, OUTPUT);             // Power the Arduino-onboard-LED
}
void loop()
{
   
// Here we start to play
    EXECUTEFAST
() {                    
        UPDATEFAST
();  

       
// Execute the code every 1 time_base_fast      
        FAST_10ms
() {
       
           
// Use Pin2 as ON/OFF command, use a pulldown resistor (10 k) connected between
           
// Pin2 and GND. Pressing for more than 1,5 seconds will set the GoodNight mode
           
// and the light will be progressly be turned off.
           
// It get the digital input state and store it in the LEDCONTROL logic
            DigIn(2, Souliss_T1n_ToggleCmd, LEDCONTROL);        
           
           
// Execute the logic that handle the LED
           
Logic_T19(LEDCONTROL);
           
Logic_T14(LEDCONTROL);

           
if(mOutput(LEDCONTROL)){
                                    mInput
(LED+1) = 100;               //brightness
                                    mInput
(LED)= Souliss_T1n_Set;
                                   
}
           
// Use the output values to control the strip
            analogWrite
(13, mOutput(LED));

           
// Just process communication as fast as the logics
           
ProcessCommunication();
       
}          
   
}
    EXECUTESLOW
()
   
{  
        UPDATESLOW
();

        SLOW_10s
()  {
       
           
// The timer handle timed-on states
           
// Timer_T14(LEDCONTROL);                        
       
}    
   
}      
}

I would be really grateful, if you could have a look at the code above and maybe give me a hint, how to modify it using the suggested T14-typical to get a independent brightness adaption in 'Scenes' working ! (of course I can also work with an related code example if this exists - adaption from working sketches is no problem for me. At least I hope ;))

Your help -as allways- is very appreciated in advance !!

Best regards, Niels




--
You received this message because you are subscribed to the Google Groups "souliss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to souliss+u...@googlegroups.com.
To post to this group, send email to sou...@googlegroups.com.

Di Maio, Dario

unread,
Aug 26, 2015, 2:41:31 PM8/26/15
to sou...@googlegroups.com
Hi Neils,

nice read that you get it working. You can request features or list bugs in the soulissapp/issues (https://github.com/souliss/soulissapp/issues) those will be evaluated by Alessandro (the author of SoulissApp) and you may get it in the next release.

Regards,
Dario.

--
You received this message because you are subscribed to the Google Groups "souliss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to souliss+u...@googlegroups.com.
To post to this group, send email to sou...@googlegroups.com.

Niels

unread,
Sep 7, 2015, 4:09:11 PM9/7/15
to souliss
Hi Dario

I came along quite good with your support so far - this part of my 'illumination project' is almost finished. While finalizing the sketches, I was wondering if there is a best practice example how to implement a fade-in/out routine for the T_14 logic set brightness states?

I really like the toggle-option of T_19 (used in 'Scenes') very much which comes with a nice 'built-in' fade-effect, either the LEDs are turned on or off.

If there is already some code to be used for 'fade-in/out', I'd be very thankful if you could let me know. I'll try to implement those lines into my existing sketch and get it working.

My initial idea was to use T_14 to set the brightness value via code and activate that value in the corresponding typical in SoulissApp to be used as the set_brightness in T_19 at the next toggle-command. BUT I do not want it to be executed instantly by T_14 (which is the current  process now). The activation should take effect as as soon as T_19 is being toggled the very next time. This routine could be easily execute via a 'Scene'  (1. T_14 (set value)  2. T_19 toggle).

Unfortunately I do not realize if this is possible with T_14 (to suppress the instant effect on the LED), just set a brightness value activating T_14 on SoulissApp and finally activate  that brightness the very next time T_19 is being toggled (to take an advantage of the T_19 fade effect!)

If you have some thoughts on this, I'd be very happy to hear those as well !!

Best regards - and many thanks for your support in advance
Niels


Di Maio, Dario

unread,
Sep 7, 2015, 4:16:23 PM9/7/15
to sou...@googlegroups.com
Hi Niels,

it mostly need on how long your fade should be, assuming that you want a short (less than a second fade) just use instead of

mInput(LEDCONTROL+1) = 100;               //brightness
mInput
(LEDCONTROL)= Souliss_T1n_Set;

use

while(mInput(LEDCONTROL+1) < 100)
{
mInput(LEDCONTROL+1)+=10;
mInput(LEDCONTROL)= Souliss_T1n_Set
delay(5);
}

This will fade in your light in steps of 10 with 5 milliseconds between each step, assuming 10 steps it will take 50 ms. 

Please consider that this is the easiest way but takes your node doing just this, so you should do it in few time. Otherwise we should follow other ways to get it.

Dario.

--
You received this message because you are subscribed to the Google Groups "souliss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to souliss+u...@googlegroups.com.
To post to this group, send email to sou...@googlegroups.com.

Niels

unread,
Sep 7, 2015, 5:28:33 PM9/7/15
to souliss
Dear Dario

Your speed and quality of support is awesome - so many thanks !!


I'll test your suggestions ASAP. Also doing some variations to find out, which delay/fade-time fits best to my needs -

I'll let you know how I come along with this in practice  ;-)

Best regards, Niels

Niels

unread,
Sep 9, 2015, 2:21:37 PM9/9/15
to souliss
Hi Dario

I did some further testing using your given lines of code (plus doing some minor adaptations concerning the timing of the fade procedure)  - at this point, the new T14_code unfortunately generates a visible delay (in which the LED should fade in but stays dark) before the LED gets turned on instantly. So there is no fade/in effect, but the duration of the desired fade effect obviously results in a delay where the LED is not getting any power. (to make it very clear, I enlarged the fade-in time as you can see in the code below- therefore it becomes very obvious for a viewer of the LED)

So the code seems to run clearly through the given 'step-up routine' (x-cycles for y milliseconds) which should causing a fade-effect, but the LED is not given any power-ups while this routine is running.

Maybe I did not implement your lines of codes properly - or maybe it is another error I'm not aware of ? Probably you can guess from my lines of code what the problem might  be, so I just add them below this text.

I'd be very thankful for every hint you might give me and use it for my further test-runs !!

Best regards, Niels


(Remark: I dropped DB and got 'New Nodes' in the SoulissApp before/after each time I loaded the new code on the Arduino)

void loop()
{
   
// Here we start to play
    EXECUTEFAST
() {                    
        UPDATEFAST
();  

       
// Execute the code every 1 time_base_fast      
        FAST_10ms
() {

       
           
// Use Pin2 as ON/OFF command - It get the digital input state and store it in the LEDCONTROL logic

           
DigIn(2, Souliss_T1n_ToggleCmd, LEDCONTROL);        
           
           
// Execute the logic that handle the LED
           
Logic_T14(LED);
           
Logic_T19(LEDCONTROL);

           
if(mOutput(LED)){

                             
while(mInput(LEDCONTROL+1) < 100)  //brightness
                                   
{
                                      mInput
(LEDCONTROL+1)+=1;
                                      mInput
(LEDCONTROL)= Souliss_T1n_Set;
                                      delay
(10);
               
// mInput(LEDCONTROL+1) = 100;               //brightness
               
// mInput(LEDCONTROL)= Souliss_T1n_Set;

                                   
}
                           
}
           
// Use the output values to control the strip

            analogWrite
(13, mOutput(LEDCONTROL+1));


           
// Just process communication as fast as the logics
           
ProcessCommunication();
       
}          
   
}

Di Maio, Dario

unread,
Sep 9, 2015, 3:19:28 PM9/9/15
to sou...@googlegroups.com

LED are non linear devices at this may be the answer of your problems.

I suggest you to print on the Serial monitor of the output value and slow in 500 ms steps, so that you can uderstand starting from which value you get some light.

Are you using a 3v3 or 5v output? How your LED is driven?

Dario.

From Mobile.

--
You received this message because you are subscribed to the Google Groups "souliss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to souliss+u...@googlegroups.com.
To post to this group, send email to sou...@googlegroups.com.

Alessandro

unread,
Sep 9, 2015, 3:28:35 PM9/9/15
to sou...@googlegroups.com
new SoulissApp includes feature to control three level of brightness via scenarios

Alessandro

Di Maio, Dario

unread,
Sep 9, 2015, 3:43:53 PM9/9/15
to sou...@googlegroups.com

Pex rules!

From Mobile.

Niels

unread,
Sep 9, 2015, 3:53:24 PM9/9/15
to souliss
Hi Alessandro

This goes for the recent SoulissAp version 1.5.2 - or is this a feature for the next update yet to come ?!!

Either way, this is/will be a great feature and I will be delighted to use it to easily fulfill my requirements.

Niels

unread,
Sep 9, 2015, 6:46:46 PM9/9/15
to souliss
Hi Dario

as for testing purpose, I'm using the onboard Arduino LED on PIN13 - this LED lights-up even at brightness 1 (using P_19 in-App-slider). So I was guessing this is a more code related issue I'm dealing with right now.

My Arduino Mega is running at 5V (at the PWM-Pins) but working with the onboard LED I think this is not relevant right now.

I was wondering if I implemented your code correctly - which might explain the non-fade but delay-effect I'm experiencing right now?!

Cheers, Niels

Alessandro

unread,
Sep 9, 2015, 6:47:28 PM9/9/15
to sou...@googlegroups.com
Hi niels, I will publish the app in beta channel tonight. I should also see german translations

Alessandro

--
You received this message because you are subscribed to the Google Groups "souliss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to souliss+u...@googlegroups.com.
To post to this group, send email to sou...@googlegroups.com.

Di Maio, Dario

unread,
Sep 10, 2015, 3:48:20 AM9/10/15
to sou...@googlegroups.com
I've checked your code from mobile and didn't recognize that inside your while() you didn't update the output value, but just runs the logic. The logic writes inside the memory of the Souliss node, then you use the output function to map this output to the phisical pin that you like.

Without you are just fading a microcontroller registrer.

Let me know if you get it working.

Dario.

Juan Pinto

unread,
Sep 10, 2015, 11:06:46 AM9/10/15
to souliss
Hi, this is already on 1.5.3? I see 4 commands on T19 but 4th is blank (maybe fail on spanish traslation)
 
Regards

Alessandro

unread,
Sep 10, 2015, 11:28:53 AM9/10/15
to sou...@googlegroups.com
Yes, it'sprobably a missing translation but there must be something else broken, as you should see 6 commands, not 4

Alessandro

Juan Pinto

unread,
Sep 10, 2015, 11:46:39 AM9/10/15
to sou...@googlegroups.com

Ok. Here a screenshot

You received this message because you are subscribed to a topic in the Google Groups "souliss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/souliss/s3pinqVBzE4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to souliss+u...@googlegroups.com.

To post to this group, send email to sou...@googlegroups.com.
Screenshot_2015-09-10-17-45-54.png

Alessandro

unread,
Sep 10, 2015, 12:00:32 PM9/10/15
to sou...@googlegroups.com
ok, I see, it's a bug PLUS missing translation.

The bug will be solved soon, while the string is "Souliss_T19_Min_desc"

Could you add it in spanish?
Thanks,
Alessandro


Juan Pinto

unread,
Sep 10, 2015, 12:35:57 PM9/10/15
to sou...@googlegroups.com

Niels

unread,
Sep 10, 2015, 3:16:53 PM9/10/15
to souliss

I'd love to see this new T_19 feature -


How can I get it running after the debug Alessandro mentioned - do I have to Update SoulissApp again !?

Cheers
Message has been deleted

Di Maio, Dario

unread,
Sep 11, 2015, 8:34:02 AM9/11/15
to sou...@googlegroups.com
Paste your code here,
Dario.

Niels

unread,
Sep 11, 2015, 8:54:33 AM9/11/15
to souliss

> > > Back on topic   ;))


Hi Dario

Using your suggestions, I tried to 'update the output value' in the given code to get the fading-logic virtually being expressed by the LED used (here: Arduino onboard). I did a number of iterations (in fact all that looked reasonable) trying to place    analogWrite(13, mOutput(LEDCONTROL+1));   into the while() loop to get it running.

Unfortunately I was not successful. From which I assume, the necessary update on the output value goes by a different line of code,

Maybe you can give me a hint, how this specific line would look like - I will place it in the code and do some tests on how this will fit my needs best.

As allways, your support is gratefully appreciated in advance !!

Best regards, Niels



Relevant part of the code:



#define LEDCONTROL       0    // This is the memory slot(s) for the logic that handle the light - 2 Slots mandatory!
#define LED              2    // This is the memory slot for the logic that handle the light


void setup()
{  
   
Initialize();
   
// Set network parameters
   
SetAddress(0xD002, 0xFF00, 0xD001);

   
Set_T19(LEDCONTROL);              // Set a logic to control a single colour LED strip

   
Set_T14(LED);                     // Set a logic to control a single colour LED strip with set brightness

   
   
// Define inputs, outputs pins
    pinMode
(2, INPUT);               // Hardware pulldown (R1: GND - 10k - Pins2) required
    pinMode
(13, OUTPUT);             // Power the Arduino-onboard-LED
}
void loop()
{
   
// Here we start to play
    EXECUTEFAST
() {                    
        UPDATEFAST
();  

       
// Execute the code every 1 time_base_fast      
        FAST_10ms
() {
       
           
// Use Pin2 as ON/OFF command - It get the digital input state and store it in the LEDCONTROL logic
           
DigIn(2, Souliss_T1n_ToggleCmd, LEDCONTROL);        
           
           
// Execute the logic that handle the LED
           
Logic_T14(LED);
           
Logic_T19(LEDCONTROL);

           
if(mOutput(LED)){

                             
//mInput(LEDCONTROL+1) = 100;
                            
// mInput(LEDCONTROL)= Souliss_T1n_Set;

                   
while(mInput(LEDCONTROL+1) < 100)            // fade-in brightness
                         
{
                           mInput
(LEDCONTROL+1)+=1;              //visible 1000ms fade-in effect
                           mInput
(LEDCONTROL)= Souliss_T1n_Set;
                           delay
(10);                           // visible 1000ms fade-in effect

                                                     
}

           
// Use the output values to control the strip

            analogWrite
(13, mOutput(LEDCONTROL));


           
// Just process communication as fast as the logics
           
ProcessCommunication();
       
}          
   
}

Di Maio, Dario

unread,
Sep 11, 2015, 10:13:33 AM9/11/15
to sou...@googlegroups.com
Hi Niels,

in order to have the output updated you need to process the logic and pass the value to the output, try the code below.

 while(mInput(LEDCONTROL+1) < 100)            // fade-in brightness
                          
{
                           mInput
(LEDCONTROL+1)+=1;              
                           mInput(LEDCONTROL)= Souliss_T1n_Set;
Logic_T19(LEDCONTROL);
analogWrite(13, mOutput(LEDCONTROL));
                           delay
(10);                          
                           
}

--
You received this message because you are subscribed to the Google Groups "souliss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to souliss+u...@googlegroups.com.
To post to this group, send email to sou...@googlegroups.com.

Niels

unread,
Sep 13, 2015, 2:56:07 PM9/13/15
to souliss
Hi Dario

Thanks for the provided code above - I did some test-runs while producing an unexpected result. As the initial problem was, to having not 'updated the output value', so the while()-logic was just generating a specific delay. The Desired fade-effect was not realized but the LED just lighted-up at the end of the while-loop instantly.

With your given code above the while-loop delay is gone and the LED lights-up instantly, but just at the brightness-value used in the while-logic to step-up (e.g. +1 in my code). The while-logic seems to run just a single cycle and then stops completely. I also tried other step-up values (like +30) to confirm this result. After this single cycle, the Arduino seems to get stuck and I cannot send any other commands nor use other typicals. It seems, using the output function to map the output to a physical pin somehow stops the while-loop in this particular case.

Maybe there is an alteration of this code which would update and map the output value and keeps running the while logic as well to provide the fade-effect.

Many thanks in advance if you should have any further ideas about this !!

Best regards, Niels

Di Maio, Dario

unread,
Sep 13, 2015, 3:02:36 PM9/13/15
to sou...@googlegroups.com
Hi Niels,

I'm sorry but looks that I've suggested you to create an endless loop o_O, paste again your actual code and likely this time we will get working properly.

Sometimes I look to the sketches quickly and miss something.

Regards,
Dario.

Niels

unread,
Sep 13, 2015, 4:09:03 PM9/13/15
to souliss

 Not a problem at all - as this is trial'n error, I'm so thankful for any help !!

Just let my know what you think and I gonna test every thing you can provide.

The relevant code now looks like:

void loop()
{
   
// Here we start to play
    EXECUTEFAST
() {                    
        UPDATEFAST
();  

       
// Execute the code every 1 time_base_fast      
        FAST_10ms
() {
       
           
// Use Pin2 as ON/OFF command - It get the digital input state and store it in the LEDCONTROL logic
           
DigIn(2, Souliss_T1n_ToggleCmd, LEDCONTROL);        
           
           
// Execute the logic that handle the LED
           
Logic_T14(LED);
           
Logic_T19(LEDCONTROL);

           
if(mOutput(LED)){
                             
//mInput(LEDCONTROL+1) = 100;
                             
// mInput(LEDCONTROL)= Souliss_T1n_Set;

                   
while(mInput(LEDCONTROL+1) < 100)            // fade-in brightness
                         
{
                           mInput
(LEDCONTROL+1)+=1;              //visible 1000ms fade-in effect
                           mInput
(LEDCONTROL)= Souliss_T1n_Set;
 
                      Logic_T19(LEDCONTROL);
                      analogWrite(13, mOutput(LEDCONTROL+1));
                         
                           delay
(10);                           // visible 1000ms fade-in effect
                                                     
}

           
// Use the output values to control the strip

            analogWrite
(13, mOutput(LEDCONTROL+1));

Di Maio, Dario

unread,
Sep 14, 2015, 6:58:48 AM9/14/15
to sou...@googlegroups.com
Yep, you got an endless loop because every time that you execute the logic, inputs are cleared, so you never get an input bigger than 100 and never quit the while.

while(mOutput(LEDCONTROL+1) < 100)            
{
mInput(LEDCONTROL+1)= mOutput(LEDCONTROL+1) + 1;   
mInput(LEDCONTROL)= Souliss_T1n_Set;
 
Logic_T19(LEDCONTROL);
analogWrite(13, mOutput(LEDCONTROL+1));
                          
delay(5);
}

In the code above we look at the actual ouput, if it doesn't match the 100 threshold (that's less than half bright) you Set a new value with increasing steps till reaching that value.

This will need 100 steps at 5ms each, so at least 500 ms to get executed. Don't go over this value, if you want to reach a bigger value (let's say 255) use bigger increase values to stay in the 300-500 ms time.

Let me know,
Dario.

Niels

unread,
Sep 14, 2015, 1:21:28 PM9/14/15
to souliss
Dear Dario

Thats’s it – IT’s ALIVE !!   ;))

Your suggestions run perfectly now. Many thanks to you – it was just the right support to finish this part of my project.

I just added another logic-cycle for fading down the brightness smoothly, if the current brightness might be above the desired value that’s being toggled. This works fine as well.

> By the way, what is the story behind this “300 – 500 ms delay” that should not be exceeded ? I remember, you mentioned that before. Is this a technical issue with Arduino, or maybe with Souliss itself ? I’d like to know some details about this to maybe prevent future problems that might come up with similar issues.

Many thanks again from my side -
Niels

P.S.: I gonna add the relevant part of this code that is running on my Arduino Mega 2560 for all (future)followers that are interested in this thread. Cheers.

Di Maio, Dario

unread,
Sep 14, 2015, 1:43:18 PM9/14/15
to sou...@googlegroups.com

Hi Niels,

out of your sketch there is a lot of code that runs in the background. For the Souliss side this is the GatewayComms and PeerComms, if your node stucks into a while it will not process any communication task.

If you need to create longer cycle, instead of stuck into the while you should exit and going in at next cycle.

Dario.

From Mobile.

--
You received this message because you are subscribed to the Google Groups "souliss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to souliss+u...@googlegroups.com.
To post to this group, send email to sou...@googlegroups.com.

Niels

unread,
Sep 14, 2015, 1:47:47 PM9/14/15
to souliss
Loops to fade up/down LED over PWM-Pin using typical T_14 via SoulissApp

This works preferably when being toggled when used as Scenery-Comnmand.

(example includes just the relevant part of code within the void loop - pls. adjust to your own presidencies as desired)

Arduino Mega2560
         Logic_PulseOutput(SLOT002);        //logig T_14 (PWM)
         
Logic_DimmableLight(SLOT000);      //logic T_19
     
       
if(mOutput(SLOT002)){                //runs if T_14 being toggled

       
while(mOutput(SLOT000+1) < 150)      // fade-up if current brightness < 150
                         
{
                           mInput
(SLOT000+1)=mOutput(SLOT000+1)+2;    //max. total fade-time (150/2*6)=450 ms        
                           mInput
(SLOT000)= Souliss_T1n_Set;
       
Logic_DimmableLight(SLOT000);
       analogWrite
(13, mOutput(SLOT000+1));                           // Output-Pin 13 onboard Arduino LED
                           delay
(6);                                  //max. total fade-time 450 ms                
                           
}

       
while(mOutput(SLOT000+1) > 150)           // fade-down to 150 brightness if current brightness > 150
                           
{
                           mInput
(SLOT000+1)=mOutput(SLOT000+1)-1;   //max. total fade-time 420 ms           
                           mInput
(SLOT000)= Souliss_T1n_Set;
       
Logic_DimmableLight(SLOT000);
       analogWrite
(13, mOutput(SLOT000+1));                         // Output-Pin 13 onboard Arduino LED                                                   delay(5);                                 //max. total fade-time 420 ms                 
                           
}        

      analogWrite
(13, mOutput(SLOT000+1));                          // Output-Pin 13 onboard Arduino LED
      FAST_PeerComms
();
   
}




Niels

unread,
Sep 14, 2015, 7:01:57 PM9/14/15
to souliss

Oh, I see - but this makes perfectly sense. While in a loop, a binary-coded machine like the Arduino is determined temporarily on this cycle. This might cause problems with other instances of the code. Luckily in my case, I'm pretty satisfied with this loop-duration you suggested before (300-500 ms). I could easily add another cycle if this would be necessary in the future.

One more thing for the Arduino  - Is there a limit to the number of typicals used in a given void-loop? And what would be the limit of the number of commands used in a single Scenario on SoulissApp?

Cheers, Niels

Di Maio, Dario

unread,
Sep 15, 2015, 1:31:31 AM9/15/15
to sou...@googlegroups.com

The memory is sized by default for 45 nodes and 24 slots, this is generally more than required for a mid size network.

You can increase this value affecting the RAM usage and the frame size on the network.

Dario.

From Mobile.

--
You received this message because you are subscribed to the Google Groups "souliss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to souliss+u...@googlegroups.com.
To post to this group, send email to sou...@googlegroups.com.

Niels

unread,
Sep 15, 2015, 7:29:19 PM9/15/15
to souliss
Ok - this sounds quite sufficient for sure if it comes to home-automation frameworks.

I guess a max. of 24 slots is defined as default in Souliss per each single node. Is it possible to increase the max. number of slots per node if a very low number of total nodes is being used in the Souliss framework?

Di Maio, Dario

unread,
Sep 16, 2015, 1:43:13 AM9/16/15
to sou...@googlegroups.com

These are global configuration values and should be consistent across all nodes. So the best is plan in advance if 24 are enough, if not increase this value from the beginning.

This will not be enough only if you use a single node as collector, like a Mega, with high number of I/O, but this isn't really a distributed approach.
In any case, it will work fine either.

Dario.

From Mobile.

On 16 Sep 2015 01:29, "Niels" <niels.c...@gmail.com> wrote:
Ok - this sounds quite sufficient for sure if it comes to home-automation frameworks.

I guess a max. of 24 slots is defined as default in Souliss per each single node. Is it possible to increase the max. number of slots per node if a very low number of total nodes is being used in the Souliss framework?

--
You received this message because you are subscribed to the Google Groups "souliss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to souliss+u...@googlegroups.com.
To post to this group, send email to sou...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages