The tutorials and code examples that can be found for the 101 all seem to be about transmitting data, but I can't find anything about receiving data. I've tried to go through the source code of the CurieBle library to find some hints but I feel a little overwhelmed/lost. Could someone point me to a code example which demonstrates how to do this?
Context: I was previously using a HC-05 module paired with an Arduino Nano in order to receive data. In this case it is quite easy to connect the HC-05 to the Nano's digital pins and receive data like so:
#define RxD 7 // This is the pin that the Bluetooth (BT_TX) will transmit to the Arduino (RxD)
#define TxD 8 // This is the pin that the Bluetooth (BT_RX) will receive from the Arduino (TxD)
SoftwareSerial blueToothSerial(RxD,TxD);
void setup() {
blueToothSerial.begin(9600);
Serial.begin(9600); // Allow Serial communication via USB cable to computer
pinMode(RxD, INPUT); // Setup the Arduino to receive INPUT from the HC-05 on Digital Pin 7
pinMode(TxD, OUTPUT); // Setup the Arduino to send OUTPUT to the HC-05 on Digital Pin 8
}
void loop() {
char recvChar;
while(1) {
if(blueToothSerial.available()) {
recvChar = blueToothSerial.read();
Serial.print("Read character: ");
Serial.println(recvChar); // Print the character received to the Serial Monitor
}
}
}
Is there some equivalent, and equally simple code available which would do the same thing via the BLE built into the Arduino 101?
DaveOR:
If you are asking if you can write to the 101 from a central device (smartphone, PC, etc) then yes, that is possible as is.
Yes, that is what I'm asking Basically I want to know how can you write to the 101 from a smart phone? (What do you need to do in the Arduino code in order to receive the transmission?)