sandeepmistry / arduino-BLEPeripheral

An Arduino library for creating custom BLE peripherals with Nordic Semiconductor's nRF8001 or nR51822.
MIT License
462 stars 179 forks source link

Is it possible to do wired UART? #236

Open marcsza opened 6 years ago

marcsza commented 6 years ago

I started developing some applications just to feed my curiosity about BLE and nrf52. With this library, is it possible to implement wired serial communication as well as scannng for beacons?

My goal is to scan for a beacon and as soon as i find it i send serial (wired) info to an arduino board. Is it possible?

Regards, marcsza

don commented 6 years ago

You can use Serial or SoftwareSerial.

francesco98 commented 6 years ago

Using SoftwareSerial, I receive this error: fatal error: util/delay_basic.h: No such file or directory

don commented 6 years ago

@francesco98 maybe your board isn't supported or you need something extra. See if other people using your board have a solution. Or use one of the UARTs built into the board.

HalFrgrd commented 6 years ago

I'm having some trouble getting uart communication between an nrf51822 and a pro micro. What is the purpose of the Uart.h/Uart.cpp files in the arduino-nrf5 core? How would I use the setpins method in those files to get uart on pins 24,25? I have this running on my nrf51822:

void setup() {
  Serial.begin(9600);
}

void loop() {
  delay(1000);
  Serial.write("testing");
}

and this running on a pro micro that is connected to the nrf51822:

void setup() {
  Serial.begin(9600);
  Serial1.begin(9600);
}

void loop() {
  if (Serial.available()) {      // If anything comes in Serial (USB),
    Serial1.write(Serial.read());   // read it and send it out Serial1 (pins 0 & 1)
  }

  if (Serial1.available()) {     // If anything comes in Serial1 (pins 0 & 1)
    Serial.write(Serial1.read());   // read it and send it out Serial (USB)
  }
}

Should this be enough to see 'testing' on the Serial Monitor?

Thanks, Hal

ankitmax commented 3 years ago

I'm having some trouble getting uart communication between an nrf51822 and a pro micro. What is the purpose of the Uart.h/Uart.cpp files in the arduino-nrf5 core? How would I use the setpins method in those files to get uart on pins 24,25? I have this running on my nrf51822:

void setup() {
  Serial.begin(9600);
}

void loop() {
  delay(1000);
  Serial.write("testing");
}

and this running on a pro micro that is connected to the nrf51822:

void setup() {
  Serial.begin(9600);
  Serial1.begin(9600);
}

void loop() {
  if (Serial.available()) {      // If anything comes in Serial (USB),
    Serial1.write(Serial.read());   // read it and send it out Serial1 (pins 0 & 1)
  }

  if (Serial1.available()) {     // If anything comes in Serial1 (pins 0 & 1)
    Serial.write(Serial1.read());   // read it and send it out Serial (USB)
  }
}

Should this be enough to see 'testing' on the Serial Monitor?

Thanks, Hal

Hello,

Did you find solution to this? That is, how to set RX and TX pins for nrf51822 UART? And use Arduino board to communicate with Nordic UART wired interface?

HalFrgrd commented 3 years ago

I can't remember sorry. I think I may have ended up using the Nordic SDK instead.