Home AMX User Forum NetLinx Studio

bargraph question

I communicate between the iLight and the amx and in the TPDesign I draw a multi-state bargraph, I want that when I raise or lower it's level it would change the light. I defined a level code in the software but I don't know how to do the push event of the bargraph.

Comments

  • Jorde_VJorde_V Posts: 393
    Hello Udi,

    Perhaps you can elongate on the problem you are experiencing. Don't you know how to send a level to a device from the bargraph or vise versa?

    I'm assuming it's the first one.
    DEFINE_EVENT
    LEVEL_EVENT[touchpanel, bargraph]
    {
        send_string dv_light,"'LIGHT=',itoa(level.value),$0D"
        send_string 0,"'LIGHT=',itoa(level.value),$0D"
    }
    

    omit the send_string dv_sound and compile and upload that to see what values it gives you. the send_string would be dependent on the protocol of your device.

    Assuming this is what you're asking. If you can give us more information it will be easier to help you.

    Jorde
  • You don't need to do a push event for the bargraph.
    The level event is enough.
    You get this event everytime you change the value of the bargraph so you can use this event to send the new value of the bargraph to the iLight.
  • udiudi Posts: 107
    Yes it is my first bargraph. I am new in the field, I just began to learn.
    I set the level code of the bargraph to 1 and the range to 0-100.
    I have a bargraph with 10 states and I want that when I slide up and down the light will change correspondingly.
    I tried this code:
    level_event[g_dvaTouchPanels,1]
    {
    send_command vLight, "'L:[01:01]:',LEVEL.VALUE"
    }
    But it didn't precisely work the light raise only when I get to state 9 and when I lower
    The bargraph down the light turn off already in state 9 also.

    Nerieru, I didn't a understand what you mean in the code you wrote what it will do? What is dv_sound device? What the commands do? And did you meant by upload?
  • Jorde_VJorde_V Posts: 393
    udi wrote: »
    Yes it is my first bargraph. I am new in the field, I just began to learn.
    I set the level code of the bargraph to 1 and the range to 0-100.
    I have a bargraph with 10 states and I want that when I slide up and down the light will change correspondingly.
    I tried this code:
    level_event[g_dvaTouchPanels,1]
    {
    send_command vLight, "'L:[01:01]:',LEVEL.VALUE"
    }
    But it didn't precisely work the light raise only when I get to state 9 and when I lower
    The bargraph down the light turn off already in state 9 also.

    Nerieru, I didn't a understand what you mean in the code you wrote what it will do? What is dv_sound device? What the commands do? And did you meant by upload?

    That was a general example. You would need to do it to your light system.

    Why are you using a multi-state bargraph? Just use a regular one.
  • udiudi Posts: 107
    I didn't understand the commands and what they do and how I upload and where can I see what the values give?

    I use a multi-state bargraph because I have a dimmer light and I want that when I raise the bargraph for example in 50% the light will also turn on in 50%.
    The light device is an iLight device. And I think that these commands don't work on this device I tried and it didn't work. They have some command of there own like N:K[AREA], L:[]..

    Why the code I wrote didn't work?
    Did I need to do the command K:P[01] :M in the level_event to store the scene level .
  • Jorde_VJorde_V Posts: 393
    udi wrote: »
    I didn't understand the commands and what they do and how I upload and where can I see what the values give?

    I use a multi-state bargraph because I have a dimmer light and I want that when I raise the bargraph for example in 50% the light will also turn on in 50%.
    The light device is an iLight device. And I think that these commands don't work on this device I tried and it didn't work. They have some command of there own like N:K[AREA], L:[]..

    Why the code I wrote didn't work?
    Did I need to do the command K:P[01] :M in the level_event to store the scene level .

    I suggest you follow an AMX Programming Course, that should help you getting started with this.

    For what you want to do you can use a normal bargraph and have it from 1-100%. If you can post the RS232/IP Protocol for an iLight I might be able to help you further.
  • udiudi Posts: 107
    How can I do the value in percent in the range high and low attribute?
    I post the doc file I have for the iLight
  • HedbergHedberg Posts: 671
    udi wrote: »
    Yes it is my first bargraph. I am new in the field, I just began to learn.
    I set the level code of the bargraph to 1 and the range to 0-100.
    I have a bargraph with 10 states and I want that when I slide up and down the light will change correspondingly.
    I tried this code:
    level_event[g_dvaTouchPanels,1]
    {
    send_command vLight, "'L:[01:01]:',LEVEL.VALUE"
    }
    But it didn't precisely work the light raise only when I get to state 9 and when I lower
    The bargraph down the light turn off already in state 9 also.

    Nerieru, I didn't a understand what you mean in the code you wrote what it will do? What is dv_sound device? What the commands do? And did you meant by upload?


    Looking at the doc you posted, it seems that the level should be ascii, not an integer value. Try:

    send_command vLight, "'L:[01:01]:',itoa(LEVEL.VALUE)"
  • Jorde_VJorde_V Posts: 393
    udi wrote: »
    How can I do the value in percent in the range high and low attribute?
    I post the doc file I have for the iLight

    the format is:
    send_command vLight,'L:[01:08]:70:3'
    

    the module expects you to send it a string, so it's not expecting an integer thrown in there. So the command you need is like Hedberg posted:
    send_command vLight,"'L:[01:01]:',itoa(level.value)'"
    

    Which turns your integer into an ascii value, so that the module understands it.

    If possible you should follow a course, because this is all stuff you do in the training.
  • udiudi Posts: 107
    Thanks I did it and it works.
    How can I register to AMX Programming Course?
    I need to be a dealer?
  • udiudi Posts: 107
    Response/Feedback massage

    I'm trying the opposite process.
    I want that when the level change in an area the bargraph will change correspondingly I wrote the command:
    data_event[vLight]
    {
    string:
    {
    if (find_string(data.text, 'L:',1))
    {
    send_level g_dvaTouchPanels,1,(Chan[1][1]*255/100)
    }
    }
    }
    But it didn’t work.
  • Jorde_VJorde_V Posts: 393
    udi wrote: »
    I'm trying the opposite process.
    I want that when the level change in an area the bargraph will change correspondingly I wrote the command:
    data_event[vLight]
    {
    string:
    {
    if (find_string(data.text, 'L:',1))
    {
    send_level g_dvaTouchPanels,1,(Chan[1][1]*255/100)
    }
    }
    }
    But it didn’t work.

    You will have to strip the string to the level value, you're also getting an ascii value while the bargraph needs an integer. So after stripping the string and saving the ascii lvl in a variable you will need to convert it with an ATOI.

    I don't know what your device has as a return string though.
  • udiudi Posts: 107
    how i strip the string by the coomand GET_BUFFER_STRING? the string is the data.text right?
Sign In or Register to comment.