Open manuelburger opened 9 years ago
Hello, I have the Adafruit nrf8001 breakout connected to an Arduino Uno. My code is as follows:
// // ancs_lcd.ino // // // Created by Luke Berndt on 8/24/14. // // #include <lib_aci.h> #include <SPI.h> #include <EEPROM.h> #include <notif.h> Notif notif(10,2); ancs_notification_t* current_notif = NULL; uint8_t message_char = 0; char wait = ' '; unsigned long screen_update_timer = 0; unsigned long backlight_timer = 0; boolean backlight = false; boolean connected = false; void ancs_connected() { backlight = 1; Serial.println("Connected!!!"); backlight_timer = millis(); connected = true; } void ancs_disconnected() { Serial.println("Disconnected!!!"); connected = false; } void ancs_reset() { connected = false; Serial.println("Reset!!!"); } void ancs_notifications(ancs_notification_t* notif) { Serial.print (F("[")); if ((notif->flags & ANCS_EVT_FLAG_SILENT) == ANCS_EVT_FLAG_SILENT) Serial.print(F("-")); else if ((notif->flags & ANCS_EVT_FLAG_IMPORTANT) == ANCS_EVT_FLAG_IMPORTANT) Serial.print(F("!")); else Serial.print(" "); Serial.print (F("] ")); Serial.print(F("Notif #")); Serial.print( notif->uid); Serial.print( F(" ; from: '")); #ifdef ANCS_USE_APP Serial.print( notif->app); #endif Serial.println( F("'")); Serial.print(F(" category: ")); switch (notif->category) { case ANCS_CATEGORY_INCOMING_CALL: Serial.println(F("incoming call")); break; case ANCS_CATEGORY_MISSED_CALL: Serial.println(F("missed call")); break; case ANCS_CATEGORY_VOICEMAIL: Serial.println(F("voicemail call")); break; case ANCS_CATEGORY_SOCIAL: Serial.println(F("social msg")); break; case ANCS_CATEGORY_OTHER: Serial.println(F("other")); break; case ANCS_CATEGORY_SCHEDULE: Serial.println(F("schedule")); break; case ANCS_CATEGORY_EMAIL: Serial.println(F("email")); break; case ANCS_CATEGORY_NEWS : Serial.println(F("news")); break; case ANCS_CATEGORY_HEALTH_FITNESS: Serial.println(F("health & fitness")); break; case ANCS_CATEGORY_BUSINESS_FINANCE: Serial.println(F("business & finance")); break; case ANCS_CATEGORY_LOCATION: Serial.println(F("location")); break; case ANCS_CATEGORY_ENTERTAINMENT: Serial.println(F("entertainment")); break; default: Serial.print(F("unknown: ")); Serial.println(notif->category, DEC); break; return; } Serial.print(F(" title: '")); Serial.print( notif->title ); Serial.println("'"); #ifdef ANCS_USE_SUBTITLE Serial.print(F(" subtitle: '")); Serial.print( notif->subtitle ); Serial.println("'"); #endif Serial.print(F(" message: '")); Serial.print( notif->message ); Serial.println("'"); current_notif = notif; message_char = 0; backlight = 1; backlight_timer = millis(); } void eepromWrite(int address, uint8_t value) { eeprom_write_byte((unsigned char *) address, value); } void setup(void) { Serial.begin(115200); Serial.println("Serial communication started..."); //print spi pins: Serial.print("SCLK:" + String(SCK)); Serial.println(""); Serial.print("MOSI:" + String(MOSI)); Serial.println(""); Serial.print("MISO:" + String(MISO)); Serial.println(""); //Wait until the serial port is available (useful only for the Leonardo) //As the Leonardo board is not reseted every time you open the Serial Monitor //If things get really crazy, uncomment this line. It wipes the saved EEPROM information for the Nordic chip. Good to do this if the services.h file gets updated. //After it is wiped, comment and reupload. // eepromWrite(0, 0xFF); Serial.println(F("Arduino setup")); notif.setup(); notif.set_notification_callback_handle(ancs_notifications); notif.set_connect_callback_handle(ancs_connected); notif.set_disconnect_callback_handle(ancs_disconnected); notif.set_reset_callback_handle(ancs_reset);
}
void loop() { notif.ReadNotifications(); }
It is basically just the example code, without the whole LCD setup. I just put in a few Serial.prints to know when I successfully connected.
I am perfectly able to run the Nordic example with the app on my iphone; connecting, sending etc. no problem -> the module works
I have the pins connected as follows and hardcoded the respective pins as follows:
//Tell the ACI library, the MCU to nRF8001 pin connections aci_state.aci_pins.board_name = BOARD_DEFAULT; //See board.h for details aci_state.aci_pins.reqn_pin = 10; //The REQN and RDYN jumpers are settable, make sure this is the same aci_state.aci_pins.rdyn_pin = 2; aci_state.aci_pins.mosi_pin = 11; aci_state.aci_pins.miso_pin = 12; aci_state.aci_pins.sck_pin = 13; aci_state.aci_pins.spi_clock_divider = SPI_CLOCK_DIV8;//SPI_CLOCK_DIV8 = 2MHz SPI speed //SPI_CLOCK_DIV16 = 1MHz SPI speed aci_state.aci_pins.reset_pin = 9; //4 for Nordic board, UNUSED for REDBEARLABS aci_state.aci_pins.active_pin = UNUSED; aci_state.aci_pins.optional_chip_sel_pin = UNUSED; aci_state.aci_pins.interface_is_interrupt = true; aci_state.aci_pins.interrupt_number = 1;
However on the Serial output on my laptop I just get the following outputs:
Arduino setup [free SRAM] 643 bytes Evt Device Started: Setup Evt Device Started: Setup Evt Command Response: : Error 82 Evt
or:
Arduino setup [free SRAM] 643 bytes Evt Device Started: Setup Evt Command Response: : Command invalid in the current device state Evt Unk Cmd: 6 Evt Command Response:
or similar, I have never been able to connect to my phone, I have tried to uncomment the lines to wipe the eeprom of the chip, but with no success.
Does anyone have any idea, what I am missing here?
Any help or advise, suggestions are greatly appreciated and valued!
I'm also having this problem. Working with the bluefruit nRF8001 chip and an arduino uno.
Hello, I have the Adafruit nrf8001 breakout connected to an Arduino Uno. My code is as follows:
}
It is basically just the example code, without the whole LCD setup. I just put in a few Serial.prints to know when I successfully connected.
I am perfectly able to run the Nordic example with the app on my iphone; connecting, sending etc. no problem -> the module works
I have the pins connected as follows and hardcoded the respective pins as follows:
However on the Serial output on my laptop I just get the following outputs:
or:
or similar, I have never been able to connect to my phone, I have tried to uncomment the lines to wipe the eeprom of the chip, but with no success.
Does anyone have any idea, what I am missing here?
Any help or advise, suggestions are greatly appreciated and valued!