Hello
I am working on a project that takes input from Bluetooth module and then send those to the system. I want the system to ask for the first variable and only after it gets the first variable it should ask for the second variable.
What is happening write now is that it asks for the first variable and then when i enter the 1st variable it asks for the second variable only once and then it asks for the first variable again. If any of you could help me stop or pause the loop until a task is complete it would be really good.
This is my program
void setup() {
Serial.begin(9600);
pinMode(13,OUTPUT);// put your setup code here, to run once:
// put your main code here, to run repeatedly:
}
void loop()
{
int x1,y1;
Serial.println(" Enter x ");
if(Serial.available()>0)
{ x1=Serial.parseInt();
Serial.println("x is");
Serial.println(x1);
}
delay(1000);
if(x1>0)
{
Serial.println(" Enter y");
y1=Serial.parseInt();
Hey
I am unable to send data from my android phone to arduino board via bluetooth. I have done it before to do the same with a different code and it worked fine. When i connect the module it blinks repeatedly
As soon as i connect my phone to the module and open the app its blinking pattern change. Like a delay then blinks twice, again delays for a while and blinks twice again and so it goes on until i exit from my app. When i exit it comes back to the previous blinking pattern
My code
void setup() {
Serial.begin(9600);
// put your setup code here, to run once:
// put your main code here, to run repeatedly:
}
void loop()
{
int x1,y1;
Serial.println(" Enter x ");
if(Serial.available())
{ x1=Serial.parseInt();
Serial.println("x is");
Serial.println(x1);
}
delay(100);
if(x1>0)
{
line11: Serial.println(" Enter y");
delay(100);
The code works pretty well with the serial monitor alone.
I am not sure if the problem is with the hardware or code or with the app. If someone has an idea of whats going on please reply.