Relay&MKR1000 not working

Hi, I was looking for some advice on my relay project. I can't seem to get it to work, and here's what I can see is happening:
I have the relay module connected through a breadboard to an Arduino MKR1000, which is running a simple wifi web server page that turns an onboard led on and off. From everything I can see, I have it all connected correctly, with 5v on relay to 5v on arduino, gnd to gnd, and the other pin to pin 6. The arduino is clearly giving power to the relay, which is connected to a mains lamp, turning it on. When I take one of the connected pins out, the relay (on COM and NO) switches off, thereby turning the lamp off. So, what I can tell is that it will work, I just can't change the state of the relay through the arduino's code. Hope somebody knows what to do - this is really bugging me!