Show Posts
Pages: 1 2 [3] 4 5 ... 53
31  Using Arduino / Motors, Mechanics, and Power / Re: Controlling 2x 24 volts DC, 450 watts motors. Where do i start ? on: September 28, 2012, 08:37:31 am
Quote
The maximum current on my motors are 4A, but that's only around stall, they typically run around 1-2A, so I have have a TIP120 and an L298 in series for each motor.

As retrolefty already said, it's never a good idea to operate electronics at or near their limits.  Doing so severely reduces the life expectancy and robustness of the circuit.  If it's a personal project, then it's a personal decision, so long as you understand the potential consequences down the road.  However, if you mix it with this...

No, i do not have lots of knowledge and experience but i'm ok with programming Arduino. I have to get 50+ units, would it be smart to go DIY and be guided ?

It's highly unlikely he needs 50+ units for his own personal use.  In those quantities, it's literally a necessity to use a robust, stable, and long lasting solution.  The consequences of not doing so are far more significant than when dealing with a one off setup.
32  Topics / Robotics / Re: Help with this code please. on: September 27, 2012, 01:29:02 pm
Code:
   myservo.write(180);             
   delay(15);
   myservo.write(90);             
   delay(15);
   myservo.write(0);           
   delay(15);

Most hobby servos read the signal line at a frequency around 50hz (about every 20 ms).  You're switching the direction at a rate faster than the servo is likely reading.  So, not only is the rate too fast for you to see what's happening, it's probably too fast even for the servo itself.

As wildbill recommended, try delays on the order of several seconds.
33  Using Arduino / Programming Questions / Re: Not passing array correctly to function on: September 25, 2012, 07:39:03 am
this...
Code:
struct Point
{
   double x;
   double y;
};

and this...
Code:
Point Collection [6][2] = {
    {1,9.3},
    {2,11.5},
    {3,12.25},
    {4,13.1},
    {5,14.2},
    {6,16.3}
};

What you're doing there is creating a two dimensional array of points, so 12 points total.  I can't be totally sure, but it doesn't look like that is your intent.  From your usage of Collection, it looks like you're really trying to just create a 1 dimensional array of 6 points and assign the x and y values using array initialization notation.

If the latter is what you're trying to accomplish, just drop the second dimension, use...
Code:
Point Collection [6] = {

34  Using Arduino / Programming Questions / Re: Search for a charactter in a file on: September 24, 2012, 03:28:05 pm
Quote
this file will be passed to an java sript evry time that there is some web request,when i recieve the request i need write in the end of the file ' ]' to close the function,
but once the web request finish ,i need to cancel the ']',and write th temperture

In that scenario, I would never write the ] to the file, but include it in the output to the java script.
35  Community / Bar Sport / Re: The bestest General Electronics forums, next to this one (obviously). on: September 24, 2012, 03:15:14 pm
Here's an electronics focused forum I occasionally peruse:
http://forum.allaboutcircuits.com/

36  Community / Bar Sport / Re: SHOUT OUT if you are female. on: September 24, 2012, 03:13:09 pm
I have worked with a small handful of female engineers over the years.  I don't think that 12.5:1 ratio is that far off.  In our current development team of 25, there are 2 females, which is a ratio of 11.5:1.
37  Using Arduino / Programming Questions / Re: Search for a charactter in a file on: September 24, 2012, 03:07:32 pm
And where are you searching for this character?  our post title says 'in a file'.  Is this some file on an SD card?

Why exactly do you not want to use the 'read' function?  How else do you expect to read data from a file?
38  Using Arduino / Programming Questions / Re: Creating Circular Buffer lib on: September 24, 2012, 03:04:34 pm
ditto for your usage of queueDuplicateExists as well.
39  Using Arduino / Programming Questions / Re: Creating Circular Buffer lib on: September 24, 2012, 03:02:42 pm
queueIsEmpty and queueIsFull are both functions, each taking a single parameter that is a pointer to a queue.

Code:
if (!queueIsEmpty)

isn't going to work, because you are not calling the function properly.  You need to call it like this:

Code:
if (!queueIsEmpty(&testqueue))

same with queueIsFull().
40  Using Arduino / Programming Questions / Re: Understanding counting with arrays on: September 24, 2012, 01:23:14 pm
Quote
FWIW, I originally wrote the program with an UNO board but then trimmed it down for use on an ATTiny44 at 8MHz

Is the problem also seen on the UNO as well as the ATTiny44?  Sounds like it may be a memory issue (which is often the case in scenarios where x number of y types works, but when I add one more, it doesn't work, and it doesn't matter which one is added).  The ATTiny44 has far less SRAM/EEPROM/Flash memory than the UNO.
41  Using Arduino / Programming Questions / Re: WiFi Connection problems - Digitalfoosball App on: September 21, 2012, 01:16:19 pm
I don't have a WiFly shield, and have no experience using one.  I did notice that the library does come with several examples.  Have you looked through those to see if they do what you are trying to do?
42  Using Arduino / Programming Questions / Re: WiFi Connection problems - Digitalfoosball App on: September 21, 2012, 10:15:47 am
sketch_sep21b:78: error: 'Status' is not a member of 'WiFlyDevice'

Why do you believe WiFlyDevice has a member called Status?  It doesn't, hence the compile error when you try to access a member that doesn't exist.

Ditto for pretty much all the errors (although I didn't confirm each and every one).
43  Using Arduino / Programming Questions / Re: Creating Circular Buffer lib on: September 21, 2012, 09:50:22 am
Sketch:
Code:
#include "circularbuffer.h"

CircularBuffer cb;


void setup() {
    Serial.begin(115200);
    ElemType elem = {0};
 
    int testBufferSize = 10; /* arbitrary size */
    cbInit(&cb, testBufferSize);
 
    /* Fill buffer with test elements 3 times */
    for (elem.value = 0; elem.value < 3 * testBufferSize; ++ elem.value)
        cbWrite(&cb, &elem);
 
    /* Remove and print all elements */
    while (!cbIsEmpty(&cb)) {
        cbRead(&cb, &elem);
        Serial.println(elem.value);
    }
 
    cbFree(&cb);
   
}

void loop()
{
   
}

Header file:
Code:
#ifndef CIRCULARBUFFER_H
#define CIRCULARBUFFER_H

#include <stdlib.h>

struct ElemType{ int value; };
 
/* Circular buffer object */
struct CircularBuffer{
    int         size;   /* maximum number of elements           */
    int         start;  /* index of oldest element              */
    int         end;    /* index at which to write new element  */
    ElemType   *elems;  /* vector of elements                   */
};
 

void cbInit(CircularBuffer *cb, int size) {
    cb->size  = size + 1; /* include empty elem */
    cb->start = 0;
    cb->end   = 0;
    cb->elems = (ElemType *)calloc(cb->size, sizeof(ElemType));
}
 
void cbFree(CircularBuffer *cb) {
    free(cb->elems); /* OK if null */ }
 
int cbIsFull(CircularBuffer *cb) {
    return (cb->end + 1) % cb->size == cb->start; }
 
int cbIsEmpty(CircularBuffer *cb) {
    return cb->end == cb->start; }
 
/* Write an element, overwriting oldest element if buffer is full. App can
   choose to avoid the overwrite by checking cbIsFull(). */
void cbWrite(CircularBuffer *cb, ElemType *elem) {
    cb->elems[cb->end] = *elem;
    cb->end = (cb->end + 1) % cb->size;
    if (cb->end == cb->start)
        cb->start = (cb->start + 1) % cb->size; /* full, overwrite */
}
 
/* Read oldest element. App must ensure !cbIsEmpty() first. */
void cbRead(CircularBuffer *cb, ElemType *elem) {
    *elem = cb->elems[cb->start];
    cb->start = (cb->start + 1) % cb->size;
}

#endif
44  Using Arduino / Programming Questions / Re: Creating Circular Buffer lib on: September 20, 2012, 04:16:08 pm
http://arduino.cc/forum/index.php/topic,97455.0.html
In particular, read item 6.
45  Using Arduino / Programming Questions / Re: Problem adjusting code to work with Arduino 1.0 on: September 20, 2012, 04:13:24 pm
Quote
Serial.write() does different stuff with bytes and ints.

That there. An int is 2 bytes. A byte is, of course, 1 byte.

So, Serial.write(160) will output the integer value 160 as two bytes of data.
But you want a single byte of data output, so as Pauls said, cast it to a byte with Serial.write((byte)160) and it will output the byte value 160 as a single byte of data.
Pages: 1 2 [3] 4 5 ... 53