Show Posts
Pages: [1] 2 3 ... 14
1  Forum 2005-2010 (read only) / Troubleshooting / Re: Error in running the structure on: November 24, 2009, 12:55:14 am
Semicolons do matter in define statements, just to be clear:

http://arduino.cc/en/Reference/Define


Quote
Tip

There is no semicolon after the #define statement. If you include one, the compiler will throw cryptic errors further down the page.

#define ledPin 3;    // this is an error

2  Forum 2005-2010 (read only) / Troubleshooting / Re: Two Buttons, Two Inputs on: August 22, 2009, 10:35:25 pm
the

Code:
const int buttonPin =2

sets up a variable with the name "buttonPin".  You can only have one variable of the exact same name, which is the root of your problem.

You'll need two of these variables, one for each button, and they'll have to be unique.  Update your code with something like

Code:
const int buttonPin1=2
const int buttonPin2=3

In the rest of your code, anything relating to the first button, make sure it uses "buttonPin1" and anything relating to the second button uses "buttonPin2"
3  Forum 2005-2010 (read only) / Troubleshooting / Re: Arduino won't upload any sketches... on: August 22, 2009, 11:27:51 pm
We've had some of the chips themselves lockup.

Generally we reflash them and they are fine from there on.

If you have access to a programmer, try that first.  

If not, try a new pre-programmed chip.
4  Forum 2005-2010 (read only) / Troubleshooting / Re: Clipboard broken in Arduino interface on: July 30, 2009, 10:59:35 pm
Not sure what to tell you.

Windows XP here, and on 2 other machines.

Tested on all...

Copies fine from IDE into both PSPad and Windows notepad.

Test both Right Click -> Copy as well as simply hitting Ctrl-C.

The only thing that doesn't work is Shift-Del.  It will delete text but doesn't copy to clipboard.  Ctrl-X works just fine for that though.
5  Forum 2005-2010 (read only) / Troubleshooting / Re: removing the bootloader process on: July 29, 2009, 12:32:35 am
Usually, I just box it up using one of these.  A bit more expensive, but if you factor your time into the equation, I consider it a push.

http://www.hvwtech.com/products_view.asp?ProductID=1075

As Lefty stated above, get yourself Lady Ada's USBTinyISP.  Invaluable for working with Atmels in general, and Essential for Arduino.
6  Forum 2005-2010 (read only) / Troubleshooting / Re: Problem with Arduino Duemilanove... on: July 24, 2009, 12:42:52 am
As stated above, make sure you choose the right chip.

We see this error in the lab if we pick the Atmega168 but the Arduino actually has the Atmega328.

What I read is that the programmer is responding with a code (0x51) and that it does not match the chip it is expecting (0x14)

Try picking a wrong board intentionally and then immediately after choosing the right board/chip again.
7  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: how do i format my sourcecode with tab in arduino on: August 06, 2009, 11:34:16 pm
Cannot duplicate here.

Windows XP SP3 - Tab works fine in IDE - adds 2 spaces every time it is pressed.
8  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: Crashed Upload on: July 11, 2009, 09:54:03 pm
Try picking your board in the options again, and verify serial port is still set right.

IIRC, a month or so ago, I noticed this error (I think) when I had an ATMega328 and the IDE was set for the ATMega168
9  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: Arduino16 does not run on Macbook on: June 29, 2009, 10:31:48 pm
Check out the link from the main page:

http://arduino.cc/en/Guide/Troubleshooting#macupdate

Quote
The latest Java update from Apple attempts to use 64-bit version of native libraries, but the Arduino application comes with a 32 bit version of the RXTX library. If you launch Arduino, you'll get an error like:

Uncaught exception in main method: java.lang.UnsatisfiedLinkError: /Applications/arduino-0016/Arduino 16.app/Contents/Resources/Java/librxtxSerial.jnilib: no suitable image found. Did find: /Applications/arduino-0016/Arduino 16.app/Contents/Resources/Java/librxtxSerial.jnilib: no matching architecture in universal wrapper

To fix this, click on the Arduino application (e.g. Arduino 16.app) in the Finder, and select Get Info from the File menu. In the info panel, click the Open in 32 Bit Mode checkbox. You should then be able to launch Arduino normally.
10  Forum 2005-2010 (read only) / Syntax & Programs / Re: Problem with Simple Fading Between Two LEDs on: November 15, 2009, 11:51:42 pm
Never knew that actually.  Should have checked that long time ago.

For anyone else following, here are the function notes:
Code:
       // We need to make sure the PWM output is enabled for those pins
      // that support it, as we turn it off when digitally reading or
      // writing with them.  Also, make sure the pin is in output mode
      // for consistenty with Wiring, which doesn't require a pinMode
      // call for the analog output pins.
        pinMode(pin, OUTPUT);

Do you have any other LEDs to try out?  I think the same setup with 2 fresh LEDs to compare notes with might help troubleshoot.
11  Forum 2005-2010 (read only) / Syntax & Programs / Re: Problem with Simple Fading Between Two LEDs on: November 15, 2009, 10:53:54 pm
2 small issues noticed:

Schematic shows you using 9 and 10, but code uses 9 and 11.

Also, you need to set the pins to outputs in the setup section.

Code:
void setup()
{
  pinMode(yellowPin,OUTPUT);
  pinMode(redPin,OUTPUT);
}
12  Forum 2005-2010 (read only) / Syntax & Programs / Re: Problem with Simple Fading Between Two LEDs on: November 15, 2009, 09:28:02 pm
Have you used resistors in your circuit?  What value?  How are they connected?  

A schematic would help, sounds like it could be a hardware issue.
13  Forum 2005-2010 (read only) / Syntax & Programs / Re: velocity measuring chronograph on: July 06, 2009, 08:38:54 pm
probably could do with a break out condition in second loop.

While waiting for second sensor to trip, if > 1000ms elapsed, break and print error out.

if you're aiming for somewhere between 300 and 400fps, 1 sec is plenty of time to decide something's wrong.
14  Forum 2005-2010 (read only) / Syntax & Programs / Re: velocity measuring chronograph on: July 05, 2009, 07:13:10 pm
Quote
1 have I interpreted the code right?
for first sensor to trip  
because here is no instruction: do nothing while sensor1 isn't tripped else start_time=micros();

As stated, it just waits around for the sensor to trip.  Nothing Else.

Quote
and the same approach apply stop_time=micros()

Yep

Quote
2 in the loop, does it check the conditions of both sensor 1 and 2 every time? wouldnt it be best if it only check sensor 1 and only if it was tripped, start checking condition of sensor 2.

No code will execute during the WHILE loops.  Until that sensor trips, it's just going to keep checking the sensor.  Read THIS

Quote
3 is it okey for me to put the rest of my code (display etc) underneath stop_time=micros(); ,, it will not disrupt the time critical start and stop code?

Yep, you're fine to put it under that.  You can even wrap all the above into a function and just call it when you want the timed event.


Quote
4 the function micros delivers one us at a time but has a resolution of 4us. meaning that the function multiplying the timers value by 4 just before delivering it to me?

I would take that to mean it's rounded to the nearest 4µs.  So if it actual = 317µs, it would return 320µs


Quote
5 what is the best method to do the math, keeping the resolution and display a value with say two decimals?

calculated_speed=((1000000*distance)/calculated_time);

1000.000 is for getting the value in m/s and not m/us  but then it of course gives me a value without decimals.

Your call on that one smiley-wink

15  Forum 2005-2010 (read only) / Syntax & Programs / Re: velocity measuring chronograph on: July 04, 2009, 02:28:34 pm
As above, KISS applies.

Assuming your sensors give you a '1' normally and a '0' when beam is interrupted, and you are connected to pins 2 and 3:

Code:

while (digitalRead(2) == 1)
{
  //Wait for first sensor to trip
}
start_time=micros();
while(digitalRead(3) == 1)
{
  //First sensor was tripped, now wait for second sensor to trip
}
stop_time=micros();
calculated_time=stop_time - start_time;

Overflow is stated as around 70 minutes, so just make sure you reset the system right before you use it, and you'll be fine.
Pages: [1] 2 3 ... 14