Show Posts
Pages: 1 ... 49 50 [51] 52 53 ... 82
751  Using Arduino / Programming Questions / Re: Delay Trouble on: January 21, 2012, 07:49:44 pm
The example is here http://arduino.cc/forum/index.php/topic,76140.msg574940.html#msg574940 and a longer explanation here http://arduino.cc/playground/Code/AvoidDelay
752  Using Arduino / Interfacing w/ Software on the Computer / Re: Processing.serial <-> Arduino Mega 2560 - fails on: January 21, 2012, 07:45:08 pm
On the processing forum there was a reply (after about one year ?!) which basically sugessted to remove the auto-reset on the Mega.
Quote
pepperbilly33 has responded to Serial with new Arduino Mega 2560 in Forums: Integration and Hardware on 07-Jan-2012 03:28 PM
i had the same problem. after some hours of searching, i finally find the solution:
1. Disable Auto Reset
2. Give some Delay after the port is open

http://www.arduino.cc/playground/Main/DisablingAutoResetOnSerialConnection
http://arduino.cc/forum/index.php?topic=50484.0
pb
I have not had time to play with that. Let me know if it works for you.
753  Community / Bar Sport / Re: Your latest purchase on: January 20, 2012, 04:07:09 pm
Just placed the order - makerbeams.eu  One starter kit and some wheels.

EDIT: NB: Attached picture only visible to logged in members.
754  International / Scandinavia / Re: Microcontroller board under water on: January 18, 2012, 04:51:12 pm
This scandinavian forum is mostly for people who want to read/write in scandinavian, rather than english. It is not for projects that happen to be in scandinavia. I'll reply in English this time, but the language should switch to Swedish or similar (Jag pratar Svenska, men skriver Dansk). Otherwise ask again in the apropiate area (Projects) and answer here that you have moved it.

The electrical challenges are (1) a water tight box. (2) I do not think the GPRS signals will travel at all in the water.

You probably have a bouy marking your trap anyhow, so I suggest putting the watertight box with the smart electronics (Arduino, GPRS) on the bouy. This means you need a cable with enough wires insde to coer light, camera release and switch.

Other challenges: The camera needs a serial port and so does the GPRS. So SoftSerial for a standard Arduino or one of the extra Serial ports on a Mega to communicate with both. I hope the camera will wait patiently while you pipe the serial picture stream up the GPRS link - the picture will be larger that the RAM available. May include a SD drive instead to store pictures and just send a "got a picture!" on the GPRS?

Good luck - sounds a fun project
755  Using Arduino / Programming Questions / Re: About interrupts ... on: January 09, 2012, 03:55:47 pm
Oh, I wanted to write that... just skimmed it now, certainly seems comprehensive (when is it too large and when is it the essentials?). I happened across one part at the end: Yes the Arduino 1.0 DOES use interrupts to handle Serial output as a background activity. (checked the core code). So you comment about believing it, can be less relgious smiley

Great work.
756  Using Arduino / Programming Questions / Re: Use Timer instead of Delay on: January 09, 2012, 03:40:31 pm
The BlinkWithoutDelay tutorial example shows the principle involved.

Clearly you have included only a sample of your code, so I am having difficulty seeing what change of program flow you want to achieve. The delayMicrosecond "needs" to be there. I guess that you want to do something else in the code, while the "note" is is being played out via your shiftout routine.

How to do two things at once, there is an explanation in the playgorund and there is another example here.
757  Community / Website and Forum / Re: Can we get a dedicated "Libraries" section? on: January 09, 2012, 03:19:56 pm
Interesting. I dont think I have seen the thought expressed before (but then I only have read 10% of the posts or so).

On the other hand, design, usage and other issues are handled in the appropiate item - LCD/Display area covers the various LCD libraries often enough.

The writers of a library usually put up a page in the wiki Playground area.

758  Community / Bar Sport / Re: Just started Arduino this year! on: January 07, 2012, 08:36:57 pm
As you ask what I think, I think that for a "first program" submitted here, it is pretty good. In particular I noticed button debounce logic using timers.  A bit lengthy for what it does, but it looked OK. I tried to see your blue-button-hang problem and then noticed a few (fatal?!) flaws, so here are a few(?) suggestions for improvement:

One minor pain with the compiler (and partly because of the chip architecture, to be fair) is that when you write
Serial.println("Hello World") the string is placed into RAM (because all data has to be in RAM to be manipulated on the stack or addresses thereto)

You only have 2K (standard Arduino, and The core also takes a hundered+ bytes RAM) so all those "Toggling Red" messages fill up. You also have an 550 byte array - TWICE. As I do not have time to count the sum of all your strings, but from just glancing through it, I'd say you've exceeded RAM.
The usual explanation for "it works sometimes," or "there is a mystic error when I do x-y-z in the program" is RAM is exceeded. This may explain your "stuck on Blue sometimes".
Correction - I just ran your program and included "memoryFree" to check the memory usage and it says you have 833 bytes left. So it isnt that.

You declare new variables all over in your loop(). The RAM usage is the same, although they reside on the stack, and not on the heap. Also they get set to zero (unless you declare them static), with the notable exception of arrays. The scope is limited to the {} block they are in, but they are allocated at the start of the loop (and a few more details)

Thus you use
Code:
    Serial.println("Start Recording:");
    char str[550]="";
    is_bound = 1 ;
Strictly speaking the array could be placed in a new memory location on every run through the loop(), but it just happens to work for you, as you have no other function calls, so the array gets placed in the same spot, and nothing has overwritten it, so it works like static for you. Except the compiler has recognized that you declare it inside a small "{ }" - block and do not use it, and thus it is optimized away - the str[550]="" does nothing. Fortunaty for you, you have a global str[], too. and all errors cancel, so to speak.

I suggest you take all your loop variables and place them outside loop(), as you want them to be static.

Code:
      }else{
        inByte = Serial.read();
      }                 
      while(inByte != '!'){ //to end the wait ! needs to be at the end
        if((inByte-'0') < 10) //Note: This was the biggest pain, for some

reason the buffer
          //     has many junk values (255 being one). So i have it check
          //     for a value that is below 10 which it should be anyway
          //     (its only a byte!). also in order to get the correct int
          //     value from a byte you must subtract '0'.
        {
          pause = pause*10; //Muliply last pause by 10 to make it easier
The problem is that you do a Serial.read call without having checked Serial.available. What happens is that while you may have sent a line with "W10!" on the serial line, it takes 10ms/char at 9600 baud. You zip through the code (your loop() probably runs in 0.1ms, if it does not execute any delay()) fetch out the W and then start doing Serial.read in a tight while loop. Serial.read returns -1 if no character has arrived yet. Until the "1" has made it, you read it and then get another thousand -1 until the "0" has gotten through.

Your choice of terminator for the number, the '!' is OK, but you could decide that any non-numeric character is the end of the number (ie the next command). Of course that only works if you do the Serial.available correct, and you may want use Serial.peek() to avoid reading the character so it gets read at the top of the loop() for the command processing.

Lastly a note on timing. If you use Arduino v0022 then all Serial.print will hang (just like the delay() function) until the last character is placed on the TX line (where it takes 10ms for the bits to make it out of the UART and up the USB line). As you echo a >10 bytes string on every button push, your button debounce logic is never used; you effectivly wait for 100ms on the first transient change. If you use the V1.0 the characters are stuffed into a buffer (64 bytes for input and 64 for output) and shipped out via interrupt, in which case the Serial.print is less than 1ms. If you attempt to send faster than it is shipped out the old behaviour occurs.

I have NOT examined you recording/playback logic. You say it works, fine. Your button logic uses a global timer and statevariable, thus you can only push one button at a time (design choice or implementation accident?). The timer variables should be unsigned long.

Dont reply on this thread, start a new one under Programming. You can use the PM function to call my attention to such a thread.

Otherwise I hope this lengthy reply has not put you off from asking more. I got carried away, sorry.
759  Community / Bar Sport / Re: Just started Arduino this year! on: January 06, 2012, 05:59:36 pm
Welcome. This is the right web place.

BTW, you'r first project, nice, we all start somewhere ("Hello World"  smiley ), but here is a coincidence: check this thread, here is someone trying something very similar (play back a timing sequence), but the program is less than ...ehr ... optimal.
760  Community / Bar Sport / Re: Your latest purchase on: January 06, 2012, 05:47:19 pm
I got a decent press drill real cheap at an flea market a few months ago (did I "log" that in this thread?). I checked it was in good working condition, but in my enthusiasm I did not notice it lacked a drill chuck.

So I've had a bit of worriying about the fitting - it is a conic rod the chuck just gets pressed on, and I finally worked out it was a B12. Finally I've plonked down hard cash to get one, and I missed the delivery this afternoon so now I have to wait until Monday. smiley-sad

About €100 including shipping and all that, The drill was only €50. Still a new equivalent is about €200 so I am still ahead, a little. smiley-razz

And yes, like cr0sh I need a vice or something to hold the piece, too. Still hoping to find that somewhere, "used, good condition."
761  Using Arduino / Project Guidance / Re: Help!! building a Copy Cat light display on: January 06, 2012, 12:23:01 pm
This is more a "Programming" issue than a "project guidance".... for when you are ready for the next attempt.

You are simply NEVER READING THE BUTTON. Check out the "Button" example again.

And the code might compile, and thus execute, but it does not do what I think you intended smiley There are several serious errors in it (if what I guess you are trying to do, from the names and layout, is correct)

The code will be much simpler if you use arrays rather then delayOne, delayTwo ... but lets leave that as the last thing to fix.

762  Using Arduino / Project Guidance / Re: Multiple DC motors from 1 pwm on: January 06, 2012, 12:08:26 pm
Basically yes, but it needs some electronics to "amplify" the Arduino signals. The single pin PWM output has to be amplified by a beefy enough transistor or two to take the current load (What is the mA rating of the motors) and then switched by another transistor to the relevant motor. The power to the motors must come from something else than the Arduino.

What will regulate the PWM output, if it is not constant - a special speed sensor/input? (could be the sum of all the LDRs)

The LDRs you need a sort of input circuit - voltage divider. Do you only need On/Off?

You may have some problems if the wires are very long, especially from the LDR to the Arduino. Use some twisted pair (hack/resuse network cables, cut of the plug)

Lastly there is the pincount - 1 digital PWM output, 20 digital switch output, 20 digital(analog?) input = 41. So it has to be a mega2560.

As an alternative, you may consider doing a simple switch with an LDR going to the motor directly and skip using the Arduino all together. It easy to make a PWM/square wave if you need torque at low speed (one little 555 chip). Of course, if your installation requires some logic (like, the motor turns for at least 30 seconds after light has triggered it) then Arduino is the way to go.
763  Community / Website and Forum / Re: Time to upgrade the forum server again on: January 03, 2012, 04:46:08 pm
Yesterday I was unable to get any connection to the site. The browser timed out. It still times out for me every 3rd page or so. It really goes in fits and bursts. This is mostly the forum but sometimes the main site, too. (and it isnt my ISP or suchlike - other sites work fine.)

And I am gulty in getting another prerson intrested in building with the Arduino, and loading the site smiley-wink - we did basic Arduino stuff over the Christmas days.

DNS/spammers ...  smiley-mad
764  Using Arduino / General Electronics / Re: Piezo Buzzer not playing melody on: December 31, 2011, 08:44:06 am
It is not the software. Both software examples work with both coil and piezo speakers. They both just turn an output pin up/down fast enougfh so you hear a tone.

The point is that IF your "piezo" is not just a plain "stupid" piezo speaker, but a "complicated" buzzer, neither software will work as ajofscott explained. (My initial kit had that problem, the kit supplier had put the wrong type in it)

If it is the right piezo speaker, and it still does not work the other possibilities might be: it is busted, you've got the wrong pin or such like.
765  Using Arduino / LEDs and Multiplexing / Re: Trouble with 7-segment led's on: December 18, 2011, 02:14:18 pm
I am sorry if my reply is limited - but I just stopped reading when I got to :
Quote
It was previously changing like it was supposed to before but now they all just display 8

There are two scenarios in my mind:

1) What did you change between "working" and "all lit"? Just undo that!

2) Puff of smoke or suchlike. Try another segment/board/Arduino.

If you are lost, in so far as you have changed lots of things do not know what works or such like, then start with a simple Blink sketch in the arduino (to ensure it works) and then connect the 13 to one LED segment (through the appropiate IC driver chips) to verify the LED and circuits.
Pages: 1 ... 49 50 [51] 52 53 ... 82