Hi everyone, I am developing an android to switch on and off a lamp using of course an arduino. the connection between the android and the arduino is done by a Bluetooth module. I found this code I am not sure if is the best option, so if someone could give me some ideas, it would be much appreciated.
Code:
int led = 13; //attributing name to the pin 13
void setup()
{
Serial.begin(9600); // initialize serial connection
pinMode(led, OUTPUT); // declare the pin led as an OUTPUT
}
void loop()
{
char caracter = Serial.read(); // variable that is responsible for reading the information received from the Bluetooth
if(caracter == 'a' )
{
digitalWrite(led, HIGH); // if the value of the variable equals a the led will be turn on
}
if(caracter == 'b' )
{
digitalWrite(led, LOW); // if the value of the variable equals b the led will be turn off
}
}
I have a Bluetooth module and have design an app, to switch on and off the light.
i am also using a power relay but I am having problems with the power relay because as soon as I turn on the arduino the relay goes on, and should be off until I use the app. do not why this is happening,
Hi... i am trying to control a light (ON/OFF) by using an android app and android. the communication is done by using a Bluetooth module. the code for the arduino that I am using is this:
int led = 13; //attributing name to the pin 13
void setup()
{
Serial.begin(9600); // initialize serial connection
pinMode(led, OUTPUT); // declare the pin led as an OUTPUT
}
void loop()
{
char caracter = Serial.read(); // variable that is responsible for reading the information received from the Bluetooth
if(caracter == 'a' )
{
digitalWrite(led, HIGH); // if the value of the variable equals a the led will be turn on
}
if(caracter == 'b' )
{
digitalWrite(led, LOW); // if the value of the variable equals b the led will be turn off
}
}
When I open the serial monitor I am able to control the light. the light should come off but it is one. but when I connect the Bluetooth module I am not able to control the light anymore. Does anyone knows why?
this is my first project, so i am new with arduino
Ebay lists about 140 bazillion bluetooth modules, even when you search for "the bluetooth module".
Of course, even if you could be bothered to tell us which bluetooth module you were talking about, you've said nothing about how it is connected to the Arduino.
Absent any useful information, all we can offer is sympathy.
THE 5 V of the arduino are connected to the breadboard
one of the GND are connected to the GND on the power Relay
the Second GND are connected to the breadboard
the VCC of the bluethoot is connected to the breadboard so does the GNF
the TXD of the Bluetooth is connected to the rx of the arduino
the rxd of the bluethoot is connected to tx of the arduino
hello everyone...im a new person for arduino..can someone tell me about the theory for my final year project..i am going to switch on the lamp at my living room using android-based smart phone to switchthe lamp..
Can you please post a copy of your sketch, using code tags?
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png or pdf?