bluefruit LE - quick Q about standardfirmata example

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
bdurack
 
Posts: 18
Joined: Tue Jul 08, 2014 3:50 pm

bluefruit LE - quick Q about standardfirmata example

Post by bdurack »

Hi there,

Firstly... I'm completely new to arduino. I'm using arduinos for my masters project (I'm a product design engineer). I'm always trying to expand my knowledge and thought this project was perfectly suited for me to try my hand with arduinos. I tried the bluefruit LE tutorial for using the firmata example. I have a neopixel RGB LED ring (not a single RGB LED), so decided to leave that out for first try. Besides that I wired everything as recommended, compiled and uploaded the example code. I couldn't connect using the app on my iPhone so checked the serial monitor and noticed I only got one line of code "adafruit BTLE firmata test", I get no advertising started (the uart example worked perfectly and I was able to send test text to and from my iPhone).

Am I doing something obviously wrong? Like do I have to remove some code for the RGB LED for it work? I had a look and couldn't find it :S

any advice would be greatly appreciated!

I don't suppose anyone knows of any simple tutorials that show how to use a adafruit neopixel and the bluefruit LE together? I find it easier to understand code that already exists (I'm not a coder/programmer by any means) and it would be great to have a starting point.

Thanks!

bdurack
 
Posts: 18
Joined: Tue Jul 08, 2014 3:50 pm

Re: bluefruit LE - quick Q about standardfirmata example

Post by bdurack »

Just discovered my ground header pin's solder has come loose (I'm hoping this is the problem). I'll get it re-soldered and hopefully it will work again!

bdurack
 
Posts: 18
Joined: Tue Jul 08, 2014 3:50 pm

Re: bluefruit LE - quick Q about standardfirmata example

Post by bdurack »

It was on my side, apologies!

I am still wondering if I can use the bluefruit and app to control the neopixel ring I have though? In the same way that you could control the RGB LED in the example? (I assume in the example you could control the red, green and blue, independently? And if connected to a pwm pin control the brightness of each colour to create different colours?

Is there a way to do that for the neopixel? If any tutorials exist to do this, that would be great!

User avatar
Franklin97355
 
Posts: 23912
Joined: Mon Apr 21, 2008 2:33 pm

Re: bluefruit LE - quick Q about standardfirmata example

Post by Franklin97355 »

Here's a whole bunch of pixels. More than you wanted but the underlying ideas are what you are after.Guggenhat

bdurack
 
Posts: 18
Joined: Tue Jul 08, 2014 3:50 pm

Re: bluefruit LE - quick Q about standardfirmata example

Post by bdurack »

Hi, thanks for the reply!

This project looks really good fun. I will definitely try it out properly after I finish this one and invest in a noepixel strip. I see that you can control colour here, but you have to physically type in the colour values in hex format. I'm looking to just control each colour (red, green and blue) using the pwm sliders like you can for regular rgb led's using the bluefruit le chip and app. Is there no way to do that for the neopixel ring??

User avatar
Franklin97355
 
Posts: 23912
Joined: Mon Apr 21, 2008 2:33 pm

Re: bluefruit LE - quick Q about standardfirmata example

Post by Franklin97355 »

You can do that but you will need to write the code to convert between the two units.

bdurack
 
Posts: 18
Joined: Tue Jul 08, 2014 3:50 pm

Re: bluefruit LE - quick Q about standardfirmata example

Post by bdurack »

ok, what two units do I need convert between?

I'm a product design engineer and this is my first real time coding, so I doubt I'd be able to do real coding. If it's basic I'm willing to put the time in, I just need a starting point really as I learn through doing examples

Thanks again for the help!

User avatar
Franklin97355
 
Posts: 23912
Joined: Mon Apr 21, 2008 2:33 pm

Re: bluefruit LE - quick Q about standardfirmata example

Post by Franklin97355 »

You would need to convert between the output from the sliders on one side to the input values for the neopixels on the other. I'm not knowledgeable of bluetooth or the app you are using.

bdurack
 
Posts: 18
Joined: Tue Jul 08, 2014 3:50 pm

Re: bluefruit LE - quick Q about standardfirmata example

Post by bdurack »

ah right ok, I'm with you. So I'd need control over the sliders on the app side to code them. I have no experience with creating apps, so I don't think I can consider that sadly. Would it be relatively simple to control each colour (red, green and blue) through 3 separate potentiometers? Someone must have done that before right? I haven't been able to find the code anywhere online though. And I've been struggling with the coding side of arduinos, especially with the neopixel side (not surprising seeing as I've only started I know).

I've been trying to use this code (used to control brightness of a single LED in this case using a potentiometer) but I'm struggling to understand how I can substitute in the code used for neopixels to get what I'm looking for (control of each individual colour). I'm assuming it can't be that complex?

Code: Select all

/*
  Analog input, analog output, serial output
 
 Reads an analog input pin, maps the result to a range from 0 to 255
 and uses the result to set the pulsewidth modulation (PWM) of an output pin.
 Also prints the results to the serial monitor.
 
 The circuit:
 * potentiometer connected to analog pin 0.
   Center pin of the potentiometer goes to the analog pin.
   side pins of the potentiometer go to +5V and ground
 * LED connected from digital pin 9 to ground
 
 created 29 Dec. 2008
 modified 9 Apr 2012
 by Tom Igoe
 
 This example code is in the public domain.
 
 */

// These constants won't change.  They're used to give names
// to the pins used:
const int analogInPin = A0;  // Analog input pin that the potentiometer is attached to
const int analogOutPin = 9; // Analog output pin that the LED is attached to

int sensorValue = 0;        // value read from the pot
int outputValue = 0;        // value output to the PWM (analog out)

void setup() {
  // initialize serial communications at 9600 bps:
  Serial.begin(9600); 
}

void loop() {
  // read the analog in value:
  sensorValue = analogRead(analogInPin);            
  // map it to the range of the analog out:
  outputValue = map(sensorValue, 0, 1023, 0, 255);  
  // change the analog out value:
  analogWrite(analogOutPin, outputValue);           

  // print the results to the serial monitor:
  Serial.print("sensor = " );                       
  Serial.print(sensorValue);      
  Serial.print("\t output = ");      
  Serial.println(outputValue);   

  // wait 2 milliseconds before the next loop
  // for the analog-to-digital converter to settle
  // after the last reading:
  delay(2);                     
}
from this tutorial - http://arduino.cc/en/Tutorial/AnalogInOutSerial

User avatar
Franklin97355
 
Posts: 23912
Joined: Mon Apr 21, 2008 2:33 pm

Re: bluefruit LE - quick Q about standardfirmata example

Post by Franklin97355 »

In a nutshell, you would read the three pots (0 - 1024) map those values to numbers (0 - 255) and then format a setPixelColor(red, green, blue) or something like that ( I don't have the syntax in front of me here) The map function looks like this http://arduino.cc/en/reference/map

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

Return to “Other Arduino products from Adafruit”