Thanks, I'll give that a shot.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Pages1
#1
User Projects / Code Examples / Re: accelerometer LED G-force display
September 09, 2013, 09:29:53 AM #2
User Projects / Code Examples / Re: accelerometer LED G-force display
September 05, 2013, 01:24:54 PM
So what I have so far is basically just the accelerometer demo code, then i deleted the Y,Z and temp Serial.print functions.
I don't know how to take the X coordinate G-force reading from the serial port and give the output to the LEDs on the 16 LED shield.
(I'm new to arduino programming,and really need this for a project of mine)
I would really appreciate any help/advice anyone could give.
Thanks,
Ben
Here's the code i have so far:
I don't know how to take the X coordinate G-force reading from the serial port and give the output to the LEDs on the 16 LED shield.
(I'm new to arduino programming,and really need this for a project of mine)
I would really appreciate any help/advice anyone could give.
Thanks,
Ben
Here's the code i have so far:
Code Select
#include <Wire.h>
#define BMA250_I2CADDR 0x18
#define BMA250_RANGE 0x03 // 0x03 = 2g, 0x05 = 4g, 0x08 = 8g, 0x0C = 16g
#define BMA250_BW 0x08 // 7.81Hz (update time of 64ms)
int AccelX;
int AccelY;
int AccelZ;
float AccelTemperature;
void setup()
{
Wire.begin();
Serial.begin(9600);
BMA250Init();
}
void loop()
{
BMA250ReadAccel();
// Print out the accelerometer data
Serial.print("x: ");
Serial.print(AccelX);
delay(100);
}
void BMA250Init()
{
// Setup the range measurement setting
Wire.beginTransmission(BMA250_I2CADDR);
Wire.write(0x0F);
Wire.write(BMA250_RANGE);
Wire.endTransmission();
// Setup the bandwidth
Wire.beginTransmission(BMA250_I2CADDR);
Wire.write(0x10);
Wire.write(BMA250_BW);
Wire.endTransmission();
}
int BMA250ReadAccel()
{
uint8_t ReadBuff[8];
// Read the 7 data bytes from the BMA250
Wire.beginTransmission(BMA250_I2CADDR);
Wire.write(0x02);
Wire.endTransmission();
Wire.requestFrom(BMA250_I2CADDR,7);
for(int i = 0; i < 7;i++)
{
ReadBuff[i] = Wire.read();
}
AccelX = ReadBuff[1] << 8;
AccelX |= ReadBuff[0];
AccelX >>= 6;
AccelY = ReadBuff[3] << 8;
AccelY |= ReadBuff[2];
AccelY >>= 6;
AccelZ = ReadBuff[5] << 8;
AccelZ |= ReadBuff[4];
AccelZ >>= 6;
AccelTemperature = (ReadBuff[6] * 0.5) + 24.0;
}
#3
User Projects / Code Examples / accelerometer LED G-force display
August 26, 2013, 05:37:28 PM
Hello,
I'm trying to get the LEDs on my 16 LED tinyshield to light up and display roughly how many Gs my Accelerometer tinyshield is outputing...e.g. (If the accelerometer registers 2.5 Gs in the Y plane then 6 of the 16 LEDs would light up, 1 for every .25 Gs)
I'm new to programming arduinos so any help showing what the code would look like to get this to work would be very appreciated.
I'm trying to get the LEDs on my 16 LED tinyshield to light up and display roughly how many Gs my Accelerometer tinyshield is outputing...e.g. (If the accelerometer registers 2.5 Gs in the Y plane then 6 of the 16 LEDs would light up, 1 for every .25 Gs)
I'm new to programming arduinos so any help showing what the code would look like to get this to work would be very appreciated.
#4
TinyDuino Processors & TinyShields / accelerometer LED G-force display
August 26, 2013, 02:56:44 PM
Hello,
I'm trying to get the LEDs on my 16 LED tinyshield to light up and display roughly how many Gs my Accelerometer tinyshield is outputing...e.g. (If the accelerometer registers 2.5 Gs in the Y plane then 6 of the 16 LEDs would light up, 1 for every .25 Gs)
I'm new to programming arduinos so any help showing what the code would look like to get this to work would be very appreciated.
I'm trying to get the LEDs on my 16 LED tinyshield to light up and display roughly how many Gs my Accelerometer tinyshield is outputing...e.g. (If the accelerometer registers 2.5 Gs in the Y plane then 6 of the 16 LEDs would light up, 1 for every .25 Gs)
I'm new to programming arduinos so any help showing what the code would look like to get this to work would be very appreciated.
#5
New Product Ideas / Re: 10 segment LED bar graph Multi colored leds
August 26, 2013, 10:43:23 AM
This is how I was thinking they would be...Just your standard 10 segment LED bar graph shrunk down to fit within the 20mm x 20mm Tinyduino profile.
(I know I could just swap different colored LEDs on the LED shield, but I have projects that would be a lot better with Liner LEDS instead of Rotary)
Here's a link to a sketch I drew, the file was to big to upload:/
=137216718&filters[recent]=1&sort=1&o=0]
http://s1276.photobucket.com/user/Ben1342/media/10segmentledshield_zpsfcab9c83.jpg.html?filters[user]=137216718&filters[recent]=1&sort=1&o=0
(I know I could just swap different colored LEDs on the LED shield, but I have projects that would be a lot better with Liner LEDS instead of Rotary)
Here's a link to a sketch I drew, the file was to big to upload:/
=137216718&filters[recent]=1&sort=1&o=0]
http://s1276.photobucket.com/user/Ben1342/media/10segmentledshield_zpsfcab9c83.jpg.html?filters[user]=137216718&filters[recent]=1&sort=1&o=0
#6
New Product Ideas / 10 segment LED bar graph Multi colored leds
August 22, 2013, 12:40:21 PM
I think a 10 segment LED bar graph with multi-colored LEDs (Imagine the first 5 LEDs are green, the next 3 are yellow and the last 2 are red) would be a great shield.
It would be a great output display for microphones, touch sensors, accelerometers, etc..
It would be a great output display for microphones, touch sensors, accelerometers, etc..
#7
New Product Ideas / Re: LED shield with 24 LED's
August 21, 2013, 11:49:24 AM
I could definitely use this. +1 vote
#8
New Product Ideas / Re: Camera shield
August 21, 2013, 11:30:48 AM
If you were to add IR LEDs around the outside edge of a dirt cheap IR camera you would get a decent night-vision Pic/Video...More IR leds = better(brighter) night-vision.
(might be pointing out the obvious here :/)
(might be pointing out the obvious here :/)
Pages1
SMF spam blocked by CleanTalk