Hot answers tagged

4

You cannot. You will need an Arduino at the servo end to generate the PWM signal from serial instructions sent over Bluetooth. Since PWM is (typically) 8-bit and serial is (typically) 8-bit you could simply have each byte as a 1:1 mapping to a PWM value. One the transmit end: bluetoothSerial.write(pwmValue); On the receive end: if (bluetoothSerial....


4

The HC-05 has an AT command, AT+BIND?, that will tell you which slave device it is connected with currently. Since you can connect to one device only at the same time, your array is going to be a very short one. AT+INQ will provide you with a list of nearby devices, to which it can connect.


4

The documentation on Arduino's website shows SoftwareSerial::read() as returning a char. No it doesn't. There is nothing in the documentation that tells you the return type. There is only an example where the returned value is assigned to a char variable. That doesn't mean that it returns a char - it just means that whatever data type it does return can be ...


3

You'll see in the code just above your third link that the function can return a value of -1 if there is no data present. Thus a 16-bit value is used to cover the range of 8-bit uint8_ts, plus one extra value to show 'no valid data available'. For simplicity, I guess. Yes. This is what it's designed for. In short, for all intents and purposes, only an 8-bit ...


3

An Arduino Leonardo has native USB support. Which means that it has separate serial interfaces to the PC and to the hardware pins. Serial is only used for the communication with the PC and is unrelated to the hardware serial pins 0 and 1. Those are exposed trough Serial1. So, if you are using the exact same Uno sketch, that uses the hardware serial pins, ...


3

You just have to send the above Bluetooth command via serial port to your Bluetooth module using print command. For example yourserial.print("AT+BIND?"); OR yourserial.print("AT+INQ"); if you are using SoftwareSerial. Otherwise just use Serial.print("AT+BIND?"); OR Serial.print("AT+INQ"); when using Rx/Tx pins. That will do the job.


2

BLK GND GND CTS That looks backwards to me. Connect GND to GND and CTS to BLK. The bluetooth module operates at a predefined baud rate. You need to ensure that your Arduino communicates at that baud rate - you don't get to pick any old baud rate. The baud rate can be changed with the AT+UART=x command (where x is a single digit representing the baud ...


2

Flip the RX and TX wires of the HC06. This is because this statement : SoftwareSerial BT(10, 11); actually means SoftwareSerial BT(RXpin, TXpin);. Considering this, 10 is your Rx and 11 is your Tx. In this case, you have to connect pin 10 (software Rx) of your Arduino to the Tx pin of your HC06 and pin 11 (software Tx) to the Rx pin.


2

The standard IO library (sscanf) can help you with that: String s = "21+22"; int x; int y; int items = sscanf(s.c_str(), "%d+%d", &x, &y); if (items != 2) /* error handling */ int z = x + y; Cheers!


2

There is no one single function for performing a calculation from a string like you are after in C. Instead you will have to parse and split your string up into chunks and convert the two numbers into integers (maybe confirming that there is a + between them) and perform the calculation on those two individual integers.


1

As mentioned by chrisl, you cannot use HC-06 as a master device. Its firmware restricts it to behave only as a slave. So even if you are able to process the analog data from LM 35, you won't be able to send it using HC-06. It would be better if you go for HC-05 module and try the command AT+ROLE: x (x = 1 for master/0 for slave) to get the job done. Coming ...


1

"You are getting 49 and 48 occasionally"? I would expect you to get 49, 48, 48, 49, 48, 48 ... 49 is '1' in ASCII and guess what 48 means :) This is because you are writing and reading bytes not characters. There is a very subtle difference. change you receiver to this and it should make more sense. void loop() { // run over and over const char ...


1

SoftwareSerial.read() returns a single character as an integer. When you print an integer the print() functions convert it to a human readable format. You want to covert (cast) the output of read() to the char type. Either: void loop() { char c; c = mySerial.read(); // store the result in a temporary variable c Serial.println(c); delay(2000); } or ...


1

I assume this wiring is correct, right? Rx > Tx Tx > Rx Gnd > Gnd Vcc > 3.3V Almost. The Arduino's TX should be reduced to 3.3V using a 10k/20k potential divider. How do I read the serial input? I've been using if(Serial.available() > 0) phoneInput = (char) Serial.read(); You should read and digest this. What datatype is the ...


1

My first one or couple of HC-06es brought its LED signal out to a pin on the base board, labeled "STATE" on mine. I tested the LED state on every loop and if it was changing regularly, took that to indicate whether it was waiting for a connection. Later modules no longer bring out the LED signal but it is available on module's edge-pin 24, according to a (...


1

A digital IO pin is only capable of powering an LED or an incredibly low powered device. It is not suitable for powering meaty RF modules. Instead you need to control the power to your module using a P-channel MOSFET as a High-Side switch. For instance, assuming a 5V module with built in 3.3V LDO: simulate this circuit – Schematic created using ...


1

Which you use depends on two factors: the HC-06 carrier board you have, and which Arduino you are using. If your carrier board has (and most do) a 3.3V regulator then you power the board from 5V. If your Arduino is a 5V Arduino (such as an Uno) then you need a voltage divider on the (arduino)TX->(hc)RX pins otherwise you risk damaging the bluetooth module.


1

If you never want to change the configuration of the module either, then no, you don't need to connect the module's RX pin. However many people want bi-directional communication. Not only the ability to send a signal to turn the LED on or off, but also the ability to get the current state of the LED - is it on or off? Or maybe to send an analog reading. Or ...


1

You'll need to be sure your SoftwareSerial's baud rate matches the HC-06's baud rate. The data sheet I have claims the HC-06's default rate is 9600 baud, but as there are commands to change it, it may not be in its factory condition right now. You may have to try sending AT+VERSION at various SoftwareSerial baud rates until one of them gets you an ...


1

You need to set HC-05 to master, and this done by soldering pin 34 of BT and connecting it to digital pin on Arduino to enter AT command. Then after powering the Arduino, you need to put pin 34 high. This way it will enter AT command. In serial monitor, follow these AT commands: AT+cmode=0 AT+ROLE=1 // THIS WILL SET THE BT AS MASTER AT+INIT AT+LINK= ????,??,...


1

For this you just have to pair the both bluetooth modules with each other.! For this use AT commands. You can find those here: https://www.rcscomponents.kiev.ua/datasheets/hc_hc-05-user-instructions-bluetooth.pdf. For pairing use MAC address of one module and hardcode it in second module using AT commands. Now from theory point of view for pairing between ...


1

Have a look at this for how to pair them http://www.martyncurrey.com/connecting-2-arduinos-by-bluetooth-using-a-hc-05-and-a-hc-06-pair-bind-and-link basically you need to use the AT mode. As far as I know you will be using the serial connection to communicate, but if you are using UNOs debugging becomes a bit more difficult, because you can't use serial for ...


1

Is it unable to operate two operations simultaneously? The only way you can do two operations simultaneously is to have two Arduinos. An Arduino can only do one thing at a time. In order to make it seem like it's doing things at once you have to create your sketch accordingly. The use of delay() is right out. As are long loops using things like while(). In ...


1

let have a look at following line of code: int servopos = bluetooth.read(); I think that you are thinking that if you type in 1 in your Bluetooth application. bluetooth.read() will pass that 1 to sevopos. But, that's what not happens. What actually happens is that it will pass the ASCII value of whatever you type in you app, to integer. So, if you have ...


1

Open the file in rb mode in your Python code. Since the Arduino SoftSerial RX buffer is 64 bytes in size, sending 60 bytes per packet to the Arduino is okay. You basically call out = file.read(60) in python to read 60 bytes from the file and then write these bytes to the Arduino with ser.write(out). You can have the python program wait for acknowledgement ...


1

Use a BJT/FET. For a NPN, connect RST to COLLECTOR, a digital pin in series with a 220 ohm (or whatever’s appropriate) resistor to BASE, and EMITTER to GND. Just bring the digital pin HIGH to reset your arduino.


Only top voted, non community-wiki answers of a minimum length are eligible