Home NetLinx Studio

Basic Volume Control, variable problem

TUTechTUTech Junior MemberPosts: 70
So I'm trying to do a basic volume control with a bar graph but I get an error. This is what I have.

Define_Device

dvBiamp = 5001:4:0

Define_Constant

Volume_Level_Max = 0
Volume_Level_Min = -100

Define_Variable

Non_Volatile SInterger snBargraphVolume[3]

BUTTON_EVENT [dvTP,41] //Volume Up
{
PUSH:
{
IF (snBargraphVolume < Volume_Level_Max); // Limit how high we increment
{
SEND_STRING dvBiamp, "VolumeUp"
snBargraphVolume++; // Increase value by 1
}
}

BUTTON_EVENT [dvTP,42] //Volume Down
{
PUSH:
{
IF (snBargraphVolume > Volume_Level_Min); // Limit how low we increment
{
SEND_STRING dvBiamp, "VolumeDn"
snBargraphVolume --; // Decrease value by 1
}
}

I get an error that says "Operators "+", "-", "/" and "*" are only allowed for 1 dimensional arrays. All I want to do is add 1 to the variable snBargraphVolume

Comments

  • JasonSJasonS If I had known it was going to be that kind of party... Posts: 229
    You defined snBargraphVolume as an array. Either define it as a single sinteger, or increment/decrement an element of the array, i.e. snBargraphVolume[1]++;
  • TUTechTUTech Junior Member Posts: 70
    You're right. Thanks. I copied part of that from another program that worked and the reason for the array was because there were 3 different volume controls. I forgot why "[3]" was in there.
Sign In or Register to comment.