Show Posts
Pages: [1] 2 3
1  Using Arduino / Project Guidance / Re: Measuring speed of falling object on: January 07, 2013, 01:44:08 am
His teacher wants him to do a repeatable experiment and show effects of changing one variable.  So we want to show that changing the wait, changes how long it takes the ball to fall a specific distance.  So not really needing to measure the speed, just the time to fall over a specific distance.

2  Using Arduino / Project Guidance / Measuring speed of falling object on: January 07, 2013, 01:23:05 am
Hi,

My son has to do a science project for 6th grade.  We are thinking about dropping weighted ping pong balls from about a 6 six story height.  We would measure how fast each ball fell.  (air resistance would cause the lighter balls to fall slower).

Any ideas on how we could time the ball drop? 

I am thinking about using two arduinos.  One would be at the top.  The ball would fall through a tube and I would use a photo sensor to detect when the ball dropped.  The top arduino would then fire a laser pointer to signal the bottom arduino to start a timer clock.  The bottom arduino would have an accelerometer attached to a table.  When the ball lands on the table, the accelerometer senses the impact and stops the clock.  I then have the start/stop time sent back to my laptop.

Anyone think this would work or have a better idea?  Would an accelerometer be able to sense this type of thing?

thanks
chad
3  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: Stepper Library bug? on: July 10, 2008, 07:35:14 pm
The one in
http://svn.berlios.de/viewcvs/arduino/trunk/hardware/libraries/Stepper/
4  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: Stepper Library bug? on: July 10, 2008, 10:59:17 am
Last night I had noticed the problem that I couldn't precisely position my stepper motor.  A quick search showed up this thread.

I just installed the patch and tried it.  From my limited testing, it seems to have fixed the problem.
5  Forum 2005-2010 (read only) / Syntax & Programs / Re: combine two 8 bit integers into a 16 bit integ on: June 03, 2008, 10:41:35 am
Thanks, exactly what I was needing.
6  Forum 2005-2010 (read only) / Syntax & Programs / combine two 8 bit integers into a 16 bit integer on: June 02, 2008, 03:42:34 pm
I have two 8 bit integers that I want to combine into one unsigned 16 bit integer.

Actually the first byte (8 bits) is the high order bits, the second byte is the low order bits.  I am reading these from an eeprom.  So I read these two bytes from the eeprom, and I want to combine them back into one 16 bit unsigned integer.

What is the "correct" way to combine these two?  I am guessing there is an easy way to first shift in the high order bits, then shift in the low order bits?

thanks
chad
7  Forum 2005-2010 (read only) / Syntax & Programs / TWI, interrupts and wiimote on: August 24, 2007, 01:42:34 pm
I have a question about TWI and interrupts.  I am using an arduino to read data from a Wiimote over TWI.  I have that working fine.  The problem is, if I have the arduino do some other processing, it looses its connection to the wiimote.  Here is an example, the wiimote sends some data to the arduino, say the number 5, I have the arduino blink an led for 5 seconds.  After that the wiimote won't send anymore data (or the arduino won't read it, not sure which).  

Is there a way to have the arduino always read TWI when data is available?  Basically I want to make TWI take priority over my other processing.  I was wondering if there was some way to do this with interrupts?

thanks
chad
8  Forum 2005-2010 (read only) / Syntax & Programs / storing TWI input in a char[] on: June 01, 2007, 10:29:11 am
Hi,

My arduino is recieving some data from a wiimote over TWI.  I have the arduino capture about 190 bytes, then the arduino transmits those back to my PC over a serial connection.  Currently I am storing the data in an uint8_t array and transmitting them over serial with Serial.print (storebuf,DEC).  That works fine and minicom reads the data fine.  

What I would like to do is store the data in a character array.  That way I could put in some spaces are commas between the data.  Right now I don't know where one set of receiveevents starts/stops.  So I wanted to insert a comma.  The problem is when I store the data in a char array and send it back to my pc with Serial.print (storebuf), I get strange characters instead of the numbers.  So it looks like my numbers from Wire.recieve don't like to be translated into characters.

Any thoughts on how I can store this as character data and have it transmit back over serial in a readable format?

thanks
chad

Here is part of my code:

uint8_t storebuf[200];
int cnt = 0;
void
receiveEvent (int howMany)
{
  while (Wire.available ())
    {
      int c = Wire.receive ();  // receive byte as a character
      storebuf[cnt] = c;
      cnt++;
      if (cnt > 100)
        {
          print ();
        }
    }
}

void
print ()
{
  int s = 0;
  Serial.println ("start data dump");
  while (s < (cnt - 1))
    {
      Serial.print (storebuf,DEC);
      s++;
    }
  Serial.println ("end data dump");
  cnt = 0;
}

Here is what I tried, but sent back bad characters.  Only the comma would print correctly:

char storebuf[200];
int cnt = 0;
void
receiveEvent (int howMany)
{
  while (Wire.available ())
    {
      char c = Wire.receive ();  // receive byte as a character
      storebuf[cnt] = c;
      cnt++;
      if (cnt > 100)
        {
          print ();
        }
    }
    storebuf[cnt] = ','; // Add in a comma
    cnt++;

}

void
print ()
{
  int s = 0;
  Serial.println ("start data dump");
  while (s < (cnt - 1))
    {
      Serial.print (storebuf);
      s++;
    }
  Serial.println ("end data dump");
  cnt = 0;
}
9  Forum 2005-2010 (read only) / Syntax & Programs / read specific bits of a byte? on: June 05, 2007, 12:48:18 pm
I am reading in a single byte over TWI.  Each bit stands for something.  I want to be able to read that byte into a data structure, then be able to reference each bit.  I had thought of something like this

struct {
  uint8_t key1:1;
   uint8_t key2:1;
   uint8_t key3:1;
   uint8_t key4:1;
   uint8_t key5:1;
   uint8_t key6:1;
   uint8_t key7:1;
   uint8_t key8:1;
} keys;

structs keys mykeys;

mykeys = SOME BYTE I HAVE.

Serial.print(mykyes.key1);  // would print a zero or one.

But the above doesn't work.  I think I an misunderstanding how struct works.  Anyone have any thoughts on what would be the simplest way to get the value of each bit?

thanks
chad
10  Forum 2005-2010 (read only) / Troubleshooting / Arduino NG and external power on: April 29, 2008, 11:20:51 pm
I seem to remember reading somewhere that if you want to power an Arduino NG with external power, that you had to add a resistor somewhere?  And that the resistor would take up one of the pings.

Is that correct?  I am sure this info is in a FAQ somewhere, but I can't find it.
11  Forum 2005-2010 (read only) / Troubleshooting / Re: arduino to minicom problem on: May 30, 2007, 08:01:54 am
That was it!  Thanks a million.
12  Forum 2005-2010 (read only) / Troubleshooting / Re: arduino to minicom problem on: May 29, 2007, 11:32:12 pm
Ok, now I am wondering if I may have fried the board.  I am trying to run code to just turn on an led:
#include <stdio.h>
#include <string.h>

void
setup ()
{
  digitalWrite (13, HIGH);      //turn on debugging LED
}

//  MAIN CODE
void
loop ()
{
  digitalWrite (13, HIGH);      //turn on debugging LED
}

I put an led on pin13/GND.    When I press the reset button, the LED flashes 3 times.  But then my code should turn the LED on, but after the 3 flashes, the LED never turns on.

So now I am thinking my serial communication problem is actually a problem with the board.  

Am I correct that the above code should turn on the LED?  Any other simple tests I can run to see if the board is working?  It was working fine last week.

thanks
chad
13  Forum 2005-2010 (read only) / Troubleshooting / arduino to minicom problem on: May 29, 2007, 11:17:47 pm
I just installed Ubuntu 7.04 on my laptop.  I removed the brltty package and I can upload code to the arduino just fine.  The problem is I can't get minicom to read data from the arduino.

The code on the arduino is:
#include <stdio.h>
#include <string.h>

void
setup ()
{
  beginSerial (19200);
  digitalWrite (13, HIGH);      //turn on debugging LED
}

//  MAIN CODE
void
loop ()
{
  Serial.print("hello\n");
  delay(100);
}

My minicom settings are:
pu port             /dev/ttyUSB0
pu baudrate         19200


Before I installed Ubuntu, I ran SUSE 10 and this program would work fine.  Now the TX light will not even blink.  I can program the arduino just fine, so this has me stumped.

Any ideas what I might have wrong?

thanks
chad
14  Forum 2005-2010 (read only) / Interfacing / Re: Scott Edwards LCD backpack on: June 30, 2007, 10:15:37 am
Thanks, I had tried that example.  I get garbage on the LCD.  I am wondering if the signal is inverted or something.  Say I send a "G" with the arduino I get something like a "v6" on the LCD.  There is a pattern to the characters.
15  Forum 2005-2010 (read only) / Interfacing / Scott Edwards LCD backpack on: June 30, 2007, 02:51:07 am
Has anyone used a Scott Edwards LCD backpack with an Arduino and got it to work?

thanks
chad
Pages: [1] 2 3