Need helping choosing bluetooth module-nRF8001 OR...?

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
inadeem
 
Posts: 2
Joined: Fri Jul 15, 2016 12:22 pm

Need helping choosing bluetooth module-nRF8001 OR...?

Post by inadeem »

I started a project and was using a HC-06 bluetooth module. I am now trying to use an iOS app to communicate with bluetooth so I need to purchase an iOS compatible bluetooth module.

I need a bluetooth module that would allow me to use the following code in it as well (mainly the PWM stuff):

Code: Select all

const int pwmPin = 11;
const int TurnLightPin = 13;

//int delay_time = 1000;

int ledState = LOW; // ledState used to set the LED
unsigned long previousMillis = 0;  // will store last time LED was updated
const long interval = 500;  // interval at which to blink (milliseconds)
int dutyCycle = 0;


void setup() {
  // put your setup code here, to run once:
//Change register values to adjust PWM frequency for PWM Pins 3 and 11: http://arduino-info.wikispaces.com/Arduino-PWM-Frequency

//TCCR2B = TCCR2B & B11111000 | B00000100;    // set timer 2 divisor to    64 for PWM frequency of   490.20 Hz (The DEFAULT) 
//TCCR2B = TCCR2B & B11111000 | B00000101;    // set timer 2 divisor to   128 for PWM frequency of   245.10 Hz
TCCR2B = TCCR2B & B11111000 | B00000110;    // set timer 2 divisor to   256 for PWM frequency of   122.55 Hz 
//TCCR2B = TCCR2B & B11111000 | B00000111;    // set timer 2 divisor to  1024 for PWM frequency of    30.64 Hz  pinMode(TurnLightPin, OUTPUT);
 pinMode(TurnLightPin, OUTPUT);
 pinMode(pwmPin, OUTPUT); 
  
  Serial.begin(9600); // Default baudrate of bluetooth -- 9600 bits/second
  Serial.println("HC-06 Bluetooth connected!!!");
  Serial.flush();
}
void loop() {

// check to see if it's time to blink the LED; that is, if the
  // difference between the current time and last time you blinked
  // the LED is bigger than the interval at which you want to
  // blink the LED.
  unsigned long currentMillis = millis();

  if ((unsigned long)(currentMillis - previousMillis >= interval)) {
    // save the last time you blinked the LED
    previousMillis = currentMillis;

    // if the LED is off turn it on and vice-versa:
    if (ledState == LOW) {
      ledState = HIGH;
    } else {
      ledState = LOW;
    }

    // set the LED with the ledState of the variable:
    digitalWrite(TurnLightPin, ledState);
  }
  
 //PWM Stuff:

while(Serial.available()){

  dutyCycle = Serial.parseInt();
  int pwmValue = (dutyCycle * 2.55 );

  analogWrite(pwmPin, pwmValue);
  Serial.print("PWMValue:");
  Serial.println(pwmValue);

} // End of While loop for PWM
} // End of void Loop


I was thinking about the nRF8001 but I read that the Adafruit Bluefruit LE UART Friend - Bluetooth Low is a better option?

Do I get one with UART or SPI? I'm not sure. My main goal is to be able to replicate the above code using either bluetooth module.

Is there a place where I can see the library functions and how to code using the bluetooth module?

Also, does the bluefruit iOS app have an option to make a custom controller layout? and have buttons send specific commands to the Arduino? (ex: if I click a button, I want it to send "A", if I click another button, I want it to send "B" etc..)?

I would really appreciate some help. Thank You.

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Need helping choosing bluetooth module-nRF8001 OR...?

Post by adafruit_support_mike »

Go with one of the nRF51822-based boards.

The nRF8001 is an older chip that doesn't support many of the features that make BLE popular. We keep it mostly for legacy reasons. The nRF51822 is a newer chip, and that's where our development is focused.

This tutorial seems to match what you're trying to do:

https://learn.adafruit.com/bluetooth-neopixel-goggles/

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”