For a major project at school i need to get a bluetooth module to be able to communicate between two HC-05 modules as a master and slave. They need to be able to press a pushbutton on the slave and it lights up a LED on the master. I have been able to get the two hc-05's to connect to each other but i cant find a code and wiring that will work for what i need to do. any help will be appreciated. Thanks
So, you have done the hard part and now need the easy bit :)
Firstly you need a button (failing that touching two wire together will just about do). There are loads of quick tutorials on the web, here is one https://www.arduino.cc/en/Tutorial/Button. They will end up with you having a pin that goes high or low when the button is pressed, you can either poll/loop to detect the press or go posh and use interrupts (leave that for later). When the pin detects the press you need to send some data via your HC05 link to the master, something like 'ON' or 1, who cares so long as the master understands it. And when it disconnects you need to send a off or 0 message (Remember the number 1 and the character '1' are not the same thing, so make sure you know what you are sending).
When the master receives the command it will execute a bit of code that will send a pin high (lets say pin 7). Connected to pin 7 will be the +ve side of a LED, the -ve leg of the led will be connected to a resistor of 200-250 ohms and the other end of the resistor will be connected to ground. Then when pin7 goes high it will light the resistor.
As always you probably will need to break it down to test it, have a little app that toggles pin 7 high for 2 seconds and low for two seconds, etc (just like blink).
There is a phenomenon called 'bouncing' which is where the useless human finger presses a switch and doesn't instantly create a perfect connection and perfect disconnection. This might make the slave send 101010101010101 when you just expect 1, you can either debounce using software or hardware, but only worry about that if you have a good quality switch :)