Show Posts
Pages: 1 ... 3 4 [5] 6 7 ... 839
61  Using Arduino / Project Guidance / Re: Server Watchdog - Reset PC/server if crashed on: July 21, 2014, 07:34:57 am
I think you ought to look for the pilot 5V source that Robin2 described. If you find it, the issue of switching power sources goes away. Also consider whether you may be able to leech enough power from the soft power switch and LED to run a standalone Arduino - the microcontroller itself draws negligible current. If you decide you do need to switch power sources, all your sources will need to supply the same voltage so you would need a regulator to drop the 5V USB down to 3.3V.

62  Using Arduino / Project Guidance / Re: cmath library error uploading to arduino on: July 21, 2014, 07:16:03 am
trying to upload my program to Arduino using a new computer:

What operating system is the new computer running?
What type of Arduino are you using?
Are you able to upload the standard examples to this Arduino on the new computer?
Which Arduino IDE version are you using?
Is it the same version used on the previous PC?
Which 3rd party libraries are used on the new PC?
Are they the same library versions and installed in the same locations as on the old PC?
63  Using Arduino / Project Guidance / Re: [LMS303DLHC][WindSensor]Tilt compensation for wind sensor on: July 21, 2014, 07:13:01 am
my direction wind sensor will be put in a boat

That changes things a lot. If the sensor is moving and rotating in three dimensions then this will alter the wind speed and direction readings. Whether it's possible to compensate for these would depend what you were trying to achieve and under what conditions. For example, getting wind direction on a sensor buoy might need a different approach to getting wind direction on a sail boat that is heeled over.
64  Using Arduino / Programming Questions / Re: M1 Not Declared on: July 19, 2014, 11:16:16 am
I don't have that robot and I'm not familiar with the sketch you're using. I suggest you post the code here, and also poswt the complete output when you try to verify it. Have you done whatever is needed to configure your IDE to support the Robot 's board type, and then selected the correct board type?
65  Using Arduino / Programming Questions / Re: ARduino as "cell phone - like" USB keayboard on: July 19, 2014, 10:52:56 am
I think there are three parts to the problem.

You need to be able to detect and recognise key presses. You should find examples and tutorials showing how to do that.

You want to be able to map key presses onto generated characters. I would do that using a little state machine which keeps track of the state of the multiple key press sequences including timeouts etc. If you're familiar with state machines this will be fairly straightforward - otherwise, you have some learning to do. I don't know whether you are going to provide any user feedback about what character they are generating - I can imagine this being quite fiddly to use without that feedback.

You need to generate the synthetic keyboard input event corresponding to each entered character. It's possible to do this with a UNO and you will find tutorials showing how to do it, but you will find it easier on aq Leonardo since this supports it as a standard feature.
66  Using Arduino / Programming Questions / Re: #define, int or const int on: July 19, 2014, 10:43:28 am
could see NO reason to use const instead of define, based on my experience and reading of the documentation.

Using a const value is better than using a macro substitution because it gives you explicit visibility and control over the type of the value. It is a better way of doing the same thing.

However, based on the level of understanding and competence in C++ you have shown so far in this thread, I'm not surprised that you have reached a different conclusion. You seem to have fundamentally misunderstood how the C++ preprocessor works, which is surprising given the experience you claim to have.

67  Using Arduino / Programming Questions / Re: Serial Monitor -> GUI on: July 19, 2014, 10:22:02 am
And it's a better IDE than the Arduino one too smiley-razz

^^^ That.
68  Using Arduino / Programming Questions / Re: Adding character to string on: July 19, 2014, 10:21:12 am
If you know that the client is only going to send one command each time it connects then you can keep reading and buffering the incoming characters until the client disconnects or you receive the terminating character 'a'.

Code:
// incomplete, untested

const byte BUFFER_LENGTH = 32; // make this long enough to hold your longest command
char buffer[BUFFER_LENGTH+1]; // +1 allows space for the null terminator
byte bufferCount;

void loop()
{
    // Create a client connection
    EthernetClient client = server.available();
    if (client)
    {
        Serial.println("Client connected");
        while (client.connected())
        {
            if (client.available())
            {
                char c = client.read();
                if(c == 'a')
                {
                    handleMessage(buffer);
                    bufferCount = 0;
                    buffer[bufferCount] = 0;
                    // if you want the server to disconnect the client after receiving the first command, call client.stop(); here
                }
                else
                {
                    if(bufferCount < BUFFER_LENGTH)
                    {
                        buffer[bufferCount++] = c;
                        buffer[bufferCount] = 0; // append null terminator
                    }
                    else
                    {
                        // buffer full - discard received character
                    }
                }
            }
        }
    }
}

void handleMessage(char *msg)
{
    your code here
}
69  Using Arduino / Programming Questions / Re: Sending single int with NRF24LO1 on: July 19, 2014, 08:15:17 am
I think I understand now.

All you need to do is record the highest number that you have received. If you receive duplicate or lower numbers, ignore them.
70  Using Arduino / Programming Questions / Re: Significant difference between millis() and micros() on: July 19, 2014, 08:12:43 am
The delay function "stops" interrupts.

I don't think that's the case.
71  Using Arduino / Project Guidance / Re: Use photoresistor to stop actuator. on: July 19, 2014, 07:59:33 am
I have been able to get it to be basically 0 or 180

You don't say what sort of actuator you have, but if you know how to move it to a given position then all you need to add is a pair of LDRs as Robin2 describes. The algorithm to control the actuator is then extremely simple.
72  Using Arduino / Project Guidance / Re: Using Arduino to access a hard drive wirelessly, how to...? on: July 19, 2014, 07:55:21 am
Is it important that you access the hard drive directly? As soon as you introduce a PC between the Arduino and the hard drive, the problem becomes much simpler to solve. If you can find/write an Arduino NFS or SMB client, it would also be easy to add a network interface and access network attached storage, windows file shares, NFS shared drives etc.
73  Using Arduino / Project Guidance / Re: Read PWM signal (12v wave) get it's frequency, output PWM converted frequency x2 on: July 19, 2014, 07:51:02 am
The rpm gauge works with arduino 5V pwm signal frequency between 10-220 HZ (tested)

It seems unlikely that you tested what you describe above, since it's neither easy nor necessary to generate a variable frequency PWM signal in this case.

All you need is to
(1) measure the incoming pulse length in microseconds.
(2) halve that value.
(3) use the technique demonstrated in blink without delay to output a square wave of that pulse length

The whole sketch would probably be about a dozen lines of code.
74  Using Arduino / Project Guidance / Re: Keypad Entry with Multiple PIN Numbers on: July 19, 2014, 07:46:08 am
It's possible, but requires a fundamental change to the way you validate PINs. Currently you validate each input against the PIN and allow the user to enter an endless sequence of numbers until you get four consecutive numbers that match the expected value. That's very unsecure, and in any case won't work when you need to support multiple PINs.

Instead I suggest you separate out entering the PIN from validating it. Require the user to enter a PIN of the expected length before you validate it. I suggest you apply a timeout between key presses so that if an incomplete PIN is entered the system will clear itself back down after a little while. Store the entered PIN as a null-terminated char array.

Store the valid PINs in an array of strings (null terminated char arrays).

When the whole PIN has been entered you can validate it by looping through each of the valid PINs and using strcmp() to test whether the entered PIN matches that entry.

It would be sensible to introduce a minimum inter-key delay, and lock the keypad out for a while after each failed attempt, to increase the time needed for a 'brute force' attack.

You should consider how you are going to configure and maintain the set of PINs. In my opinion it would be more sensible to do the PIN validation and logging on an attached PC and just use the Arduino as an interface to the keypad and display etc; with this approach, the valid PINs would be defined on the PC (where they are easy to display and change) and the Arduino part can be relatively dumb.
75  Using Arduino / Programming Questions / Re: Sending single int with NRF24LO1 on: July 18, 2014, 07:53:57 pm
I also would like to stop receiving a specific number once its been received. Otherwise I have scene numbers coming in like crazy

Do you mean you want to stop *sending* it? The receiver will receive whatever is sent.

If you can explain exactly what behaviour you want, I'm sure it will be possible to achieve it.
Pages: 1 ... 3 4 [5] 6 7 ... 839