Bluetooth Controlled Lights

Today I finally finished my wireless colored lights that are controlled with bluetooth. I used the BlueSMIRF Gold on one of the Axon's UART lines and wrote up a program that "listens" on the BlueSMIRFs Rx line ( the line where the incoming serial data is) for the key presses. There are four colors of LEDs and each is controlled by the first letter of the color ( the code for white is "w" ). I used ZTerm on MacOSX as the terminal emulator . It has extremely long range as well - I can control the lights from the second floor when the lights are in the basement.

Here is the code used:

// *************** Bluetooth Lights ****************
#define blue_on PORT_ON(PORTC,0)

#define yellow_on PORT_ON(PORTC,1)

#define red_on PORT_ON(PORTC,2)

#define white_on PORT_ON(PORTC,3)

void all_off(void)






} // end routine

// *************END BLUETOOTH Setup******************

Code (example show is for blue only , just change the letter and color for the others):

char cByte = uart0GetByte(); // get byte from UART0 on the axon
if (cByte == 'b') // if character received is b then
all_off(); // turn all LEDs off
blue_on; // turn only blue LED on