- This topic has 1 reply, 2 voices, and was last updated 8 years, 3 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.
|
Microcontroller › Arduino › How to make wireless notice board using arduino and hc-05
Hi !!
I want to make wireless notice board.I m not able to receive data on lcd.please tell me my mistake in this program.Thanks in advance.
#include <LiquidCrystal.h>
#include <SoftwareSerial.h>
SoftwareSerial BTSerial(2,3);//rx,tx
char cmd_arr[40];
LiquidCrystal lcd(4,5,6,8,9,10);
//*************************************************
void serial_get_command()
{
int i;
char inchar=0;
int cmd_count=0;
for(i=0;i<=31;i++){
cmd_arr=' ';
}
if(Serial.available() > 0)
{
inchar = Serial.read();
if(inchar == '<')
{
cmd_count=0;
while(inchar != '>' && cmd_count<33)
{
if(Serial.available() > 0)
{
inchar = Serial.read();
cmd_arr[cmd_count++] = inchar;
cmd_arr[cmd_count] = ' ';
}
}
if(inchar == '>')
{
cmd_arr[cmd_count-1] = ' ';
Serial.print("Cmd received : ");Serial.println(cmd_arr);
Serial.print("OK");
lcd.clear();
lcd.setCursor(0, 0);
for(i=0;i<=15;i++){
lcd.print(cmd_arr);
}
lcd.setCursor(0, 1);
for(i=16;i<=31;i++){
lcd.print(cmd_arr);
}
//serial_process_command();
}
}
}
}
//*************************************************
void setup()
{
BTSerial.begin(9600);
Serial.begin(9600);
Serial.println("System Started!");
lcd.begin(16, 2);
lcd.print("Bluetooth Based ");
lcd.setCursor(0, 1);
lcd.print(" Notice Board");
delay(2500);
lcd.clear();
}
//*************************************************
void loop()
{
serial_get_command();
}
//*************************************************
Check the setup function. It is not called??? or else make the setup codes away from the functions.