Hi I'm facing some problems using the Mega 2560 and Adafruit nRF8001 BLE
The follow code works on Arduino UNO, but when I try to run it on Mega doesn't work.
My Arduino IDE version is 1.8.5
I already...
• Checked pin connections
• Checked the pin SCK/MISO/MOSI connection differences between UNO and Mega
• restarted the machine
• No issues on upload the code
Note when I remove "blePheripheral.begin();" can see the log string "testing" on the loop
I've run the Adafruit sample code for the NRF8001 but the problem is the same on MEGA
Reference Adafruit nrf8001 sample Introduction | Getting Started with the nRF8001 Bluefruit LE Breakout | Adafruit Learning System
#include <SPI.h>
#include <BLEPeripheral.h>
#define BLE_REQ 10
#define BLE_RDY 2
#define BLE_RST 9
#define SERVICE "39F6138B6E6F49949BEEE2EC2B3AC2FD"
#define CHARACTERISTIC "76943028737C4DCB942F780CB034D757"
BLEPeripheral blePeripheral = BLEPeripheral(BLE_REQ, BLE_RDY, BLE_RST);
BLEService service = BLEService(SERVICE);
BLECharCharacteristic characteristic = BLECharCharacteristic(CHARACTERISTIC, BLENotify);
void setup() {
Serial.begin(9600);
blePeripheral.setLocalName("local name");
blePeripheral.setDeviceName("MyDeviceBLE");
blePeripheral.setAdvertisedServiceUuid(service.uuid());
blePeripheral.addAttribute(service);
blePeripheral.addAttribute(characteristic);
blePeripheral.begin();
Serial.println("BLE DEVICE");
}
void loop() {
Serial.println(F("testing"));
delay(500);
blePeripheral.poll();
}
Thank you in advanced any help are welcome!