Mikroe Click Relay module demo for NXP Freedom board (tested on FRDM-K64F)

Dependencies:   mbed

Fork of frdm_Click_Relay_Example by NXP

Simply Import this Program into your mbed compiler
Select Compile to generate the binary file
Plug the Mikroelektronika FRDM-K64F Click SHIELD on the top of your FRDM-K64F
Connect the Mikroelektronika Relay Click module in the Socket 1 of the Click SHIELD.


Drag n drop the frdm_Click_Relay_Example_K64F.bin into the mbed drive from your file explorer
Wait for download to complete
Press the Reset/SW1 button of your FRDM-K64F board to launch the program

There is two relays on the Mikroelektronika RELAY Click module

Relay1 should now switch On and Off with LED Red as indicator each time you press the SW2 button of your FRDM-K64F (see picture below)!!


Relay2 should now switch On and Off with LED Orange as indicator each time you press the SW3 button of your FRDM-K64F (see pictures below)!!


Tue Apr 26 16:51:48 2016 +0000
Mikroe Click Relay module demo for NXP Freedom boards (tested on FRDM-K64F)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
GregC 0:3b9b4fce896e 1 #include "mbed.h"
GregC 0:3b9b4fce896e 2
GregC 1:665830412d05 3 DigitalOut relay1(D6);
GregC 0:3b9b4fce896e 4 InterruptIn sw2(SW2);
GregC 0:3b9b4fce896e 5
GregC 1:665830412d05 6 DigitalOut relay2(D10);
GregC 1:665830412d05 7 InterruptIn sw3(SW3);
GregC 1:665830412d05 8
GregC 0:3b9b4fce896e 9 void sw2_release(void)
GregC 0:3b9b4fce896e 10 {
GregC 1:665830412d05 11 relay1 = !relay1;
GregC 1:665830412d05 12 }
GregC 1:665830412d05 13
GregC 1:665830412d05 14 void sw3_release(void)
GregC 1:665830412d05 15 {
GregC 1:665830412d05 16 relay2 = !relay2;
GregC 0:3b9b4fce896e 17 }
GregC 0:3b9b4fce896e 18
GregC 0:3b9b4fce896e 19 int main()
GregC 0:3b9b4fce896e 20 {
GregC 0:3b9b4fce896e 21 sw2.rise(&sw2_release);
GregC 1:665830412d05 22 sw3.rise(&sw3_release);
GregC 0:3b9b4fce896e 23 while (true) {
GregC 0:3b9b4fce896e 24 }
GregC 0:3b9b4fce896e 25 }