i have a problem whit bluetooth, when arduino is connected whit the pc it work very well, but when i connect arduino with a 9v battery it doesn't work....
when i send "1" it read "49"...
the code :
String state = "0";
int flag = 0;
void setup() {
pinMode(13, OUTPUT);
Serial.begin(9600);
}
void loop() {
if(Serial.available()>0){
state = Serial.read();
flag = 0;
I am assuming you are powering the HC06 from your Arduino, Vcc and GND connected between the two.
9v batteries are not good for running the Arduino and other modules. 9v Alkaline are @400-600mah, and made for low drain applications. If they are older type carbon/zinc 9v (super or heavy duty) they will be @150-200mah.
Neither type is useful for micro controller applications. I would suggest 4-5 AA rechargeable or at the very least 4 AA alkaline batteries.
Tommy_Ita19:
So.. i need to attach 4 AA batteries to arduino?
No. Six minimum. I would be a bit inclined towards eight.
Using four AA rechargables is even dumber than using a PP3 9v. Using four AA alkalines is less dumb but only very slightly.
I submit the above applies even if you are using a fancy super-efficient regulator to by-pass the onboard stuff, and I don't see any discussion in that direction.