http://mbed.org/users/edodm85/notebook/HC-05-bluetooth/
Pin description
Schematic for Trasparent data mode
mbed ARM code:
#include "mbed.h"
Serial blue(p9,p10); // HC05
DigitalOut myled(LED1);
DigitalOut led5(p5);
DigitalOut myled2(LED4);
DigitalOut led6(p6);
int main()
{
blue.baud(9600);
while (1)
{
if (blue.readable())
{
if(blue.getc()=='1')
{
blue.printf(" LED5 is ON please press '0' to OFF ");
myled = 1;
led5=1;
}
if(blue.getc()=='0')
{
blue.printf(" LED5 is OFF please press '1' to ON ");
myled=0;
led5=0;
}
if(blue.getc()=='3'){
blue.printf(" LED6 is ON please press '2' to OFF ");
myled2=1;
led6=1;}
if(blue.getc()=='2')
{
blue.printf(" LED6 is OFF please press '3' to ON ");
myled2=0;
led6=0;
}
if(blue.getc()=='5')
{
blue.printf(" CHECK THE STATUS OF LEDS ");
if(led5==1)
blue.printf(" LED5 is ON please press '0' to OFF ");
if(led5==0)
blue.printf(" LED5 is OFF please press '1' to ON ");
if(led6==1)
blue.printf(" LED6 is ON please press '2' to OFF ");
if(led6==0)
blue.printf(" LED6 is OFF please press '3' to ON ");
}
}
}
}
Free Android APK HC05: https://play.google.com/store/apps/details?id=appinventor.ai_sandro_juca.BT4SanUSB_HC05
ReplyDelete