Hello again Folks
I feel really bad to post here again
I was pretty sure to get that working without any helpā¦ but it seems not :S
After I got the Button and Joystick to work i gave a try to the RelayISOx16 Module.
The implementation was pretty easy and i found also itās methods to useā¦ but somehow is nothing happening when I enable a Relay.
button.ButtonPressed += new GTM.GHIElectronics.Button.ButtonEventHandler(button_ButtonPressed);
}
void button_ButtonPressed(GTM.GHIElectronics.Button sender, GTM.GHIElectronics.Button.ButtonState state)
{
relayISOx16.EnableRelay(5);
throw new NotImplementedException();
}
it looks as simple as it should beā¦
Did I do something wrong?
I couldnāt find any code on the Seed site or the Sharecode page :S
Someone a small tipp?
No camera to hand. I have a Multimeter to check if it switched.
But the Module itself has LEDs on it.
When I give the 12V to the RelayModule all LEDs are red and none of the connections on the relays is activeā¦ the opener neither the closer.
When I plug the Hydra all Relays are ready in the opener position. the multimeter comfirms that.
When i activate the button i get into the button methode and i get also my debug.printā¦
I also tried it with DisableRelay(); just to be sureā¦
is it correct to have just a number as argument? this āushort relayā is a bit confusingā¦
cuz it doesnāt accept an variable like int RelayNr = 1; Edit: okā¦ itās not working cuz of the datatype^^
relayISOx16.EnableRelay(RelayNr);
Debug.Print("Program Started");
button.ButtonPressed += new GTM.GHIElectronics.Button.ButtonEventHandler(button_ButtonPressed);
}
void button_ButtonPressed(GTM.GHIElectronics.Button sender, GTM.GHIElectronics.Button.ButtonState state)
{
relayISOx16.EnableRelay(5);
Debug.Print("Enabled!");
//throw new NotImplementedException();
}
Relays are defined as a bitmask. So they go like this:
Relay1 = 1
Relay2 = 2
Relay3 = 4
Relay4 = 8 etc.
Now you just sum the numbers of relays you want to enable. For example: 5 will enable Relay1 & Relay3.
You donāt have to input numbers directly you can use constants defined in RelayISOx16.Relay:
RelayISOx16.Relay.Relay_1
RelayISOx16.Relay.Relay_2
RelayISOx16.Relay.Relay_3 etc.
and to enable Relay1 & 3 this way you need to use boolean OR like this: .EnableRelay(RelayISOx16.Relay.Relay_1 | RelayISOx16.Relay.Relay_3);
Debug.Print("Program Started");
button.ButtonPressed += new GTM.GHIElectronics.Button.ButtonEventHandler(button_ButtonPressed);
}
void button_ButtonPressed(GTM.GHIElectronics.Button sender, GTM.GHIElectronics.Button.ButtonState state)
{
relayISOx16.EnableRelay([em]RelayISOx16[/em].Relay.Relay_1);
Debug.Print("Enabled!");
//throw new NotImplementedException();
}
RelayISOx16 is unknown in this context. i also tried small lettersā¦ then it says āError 1 āRelayā: On a Type can not be referenced by an expression. Instead, use āGadgeteer.Modules.GHIElectronics.RelayISOx16.Relayā.ā
Replacing Relay with āGadgeteer.Modules.GHIElectronics.RelayISOx16.Relayā didnāt help either
The problem with only working on sockets 3 and 4 was specifically related to the Gadgeteer Designer part of Visual Studio. Additionally that bug is fixed in the latest/current SDK.