Show Posts
Pages: 1 [2] 3 4 ... 840
16  Using Arduino / Programming Questions / Re: float switch loop with timing help needed with coding on: July 29, 2014, 01:15:39 pm
It would be better to post a complete sketch that demonstrates the problem, so we don't have to guess what else is going on and how your data is declared.

I think this logic would be simpler if you implemented it as a state machine. I suspect the state machine would only need two states (off and pumping) and you would check for float switch changes and timeouts appropriate to each state. I'm not sure what you intend to happen if the timers expire - perhaps you need a separate fault state where you turn everything off and wait for help.
17  Using Arduino / Programming Questions / Re: Read only the first row of data from a loop on: July 29, 2014, 01:11:50 pm
Put the first set of readings in row 0 of a 2 dimension array then ...

That could be made to work too, but I think the initial set of readings is used for a different purpose to the subsequent ones and storing both sets in a single 2-d array hides / loses that distinction. Two separate arrays (one for the calibration values, the other for the runtime values) makes more sense to me.
18  Using Arduino / Programming Questions / Re: Read only the first row of data from a loop on: July 29, 2014, 12:51:06 pm
Maximum of one thread per question please.
19  Using Arduino / Programming Questions / Re: Read only the first row of data from a loop on: July 29, 2014, 12:49:21 pm
Please use code tags when posting code, to stop the forum software mangling it.

I suggest you put a for loop in setup() which reads the initial value from each sensor and stores it into your reference array. Then you can subtract those values from the sensor values you read subsequently in loop().
20  Using Arduino / Project Guidance / Re: Help with how to approach my aquarium controller on: July 29, 2014, 12:46:31 pm
I'm sorry you feel like that, because I think you've already made good progress with the projects you've completed so far and I don't see any reason you couldn't continue and complete the project if you want to. I didn't envisage that the prototyping would involve any different hardware than you already have. You mentioned a UNO and a display/button shield and that is exactly what I'd use for prototyping.

Note that you will need a driver circuit between the Arduino and any motor or relay that it is going to operate. The Arduino I/O pins are safe for 20mA and have an absolute limit of 40mA which is way less than you need to operate even a tiny relay, and they need flyback protection in order to drive any inductive loads. You can get motor shields or separate driver boards which contain the necessary electronics - or you can make up your own circuit from discrete components if you want.
21  Using Arduino / Programming Questions / Re: Saving RF24 signals to memory on: July 29, 2014, 10:54:02 am
This is no longer an RF24 issue. You know how to send and receive a message containing a number. All you need to do now is handle the received number. To achieve what you want you will need to remember the 'current number' and I suggest you store that in a global variable. When you receive a number which equals current number plus one, update the current number to the new one. That requires two lines of code which you should find trivial to write compared to the work to get the RF24 interface working.
22  Using Arduino / Project Guidance / Re: Update firmware via USB on: July 29, 2014, 10:51:12 am
Turn on the IDE option for verbose output during the upload, and you can see exactly what commands the IDE runs to invoke the compiler and then invoke AVRDUDE to upload it. The IDE is just a pretty front end which calls other tools to compile and upload the sketch and they are all freely available for you to use directly.
23  Using Arduino / Project Guidance / Re: Help with how to approach my aquarium controller on: July 29, 2014, 10:48:46 am
I keep finding myself in a position where I am baffled by numerous people with numerous abstractions which always leave me feeling like achieving this is outside of the scope of my abilities.

That's a normal healthy situation when you are facing a significant learning curve. If you break the problem down into small parts rather than try to learn how to do everything in one go, I'm sure you will find it easier to understand. I suggest you start with Robin2's example and understand the general approach it is demonstrating, and then use that approach to implement a little state machine to manage the user interface. This doesn't need to be the all-singing and all-dancing final version - just a minimal menu system that you can use to figure out how this stuff works. For example you could start with a menu that displays a different screen depending which button was pressed.
24  Using Arduino / Programming Questions / Re: Controlling a small stepper motor with the millis() command on: July 29, 2014, 10:09:43 am
    if(currentMillis - previousMillis >= move2);{

Get rid of the semicolon - it makes the 'if' statement ineffective.

If you want to check for a value being in one of a set of possible ranges, you can do this with a cascading sequence of if/else statements. In your case the different values represent a logical sequence so it makes the code clearer if the order of your code matches the order of execution. You can achieve that by reversing the comparisons like this:

if(currentMillis - previousMillis < move1)
    // waiting for first move
else if (currentMillis - previousMillis < move2)
    // first move in progress
else if (currentMillis - previousMillis < move3)
    // second move in progress
25  Using Arduino / Project Guidance / Re: Help with how to approach my aquarium controller on: July 29, 2014, 10:00:36 am
To prompt a menu with a button I would use ext int0 or int1.

Interrupts should only be used when necessary and then only reluctantly and to the least extent possible. There is absolutely nothing about handling button input that requires interrupts, and using interrupts introduces a lot of design issues which will just make it harder to get a working solution.

To display the menu system I suggest you implement a state machine to keep track of which menu is currently displayed. It is easy to read and debounce buttons and detect transitions yourself following the examples that come with the IDE, or you can use the Bounce library to make it even easier. The output either way would be that you know when a button has been pressed and which button it was. You can use that to trigger code within your state machine. Simple state machines like this can be implemented by defining a set of constant values representing the different states, defining a global variable to hold the value representing the current state, and using a switch/case statement to execute the code corresponding to the current state.

Since you want to control multiple things at one you should use a non-blocking approach  - Robin2 posted some example code which demonstrates this technique very well:

To save the configuration values I suggest you define a struct to hold the current configuration and use the EEPROM write anything code fragment from the playground to write it to EEPROM each time the configuration changes, and read it back from EEPROM at startup.
26  Using Arduino / Project Guidance / Re: Problem..level control with arduino and gsm!! on: July 29, 2014, 09:50:25 am
From your description it seems as if your Arduino solution doesn't work at all. This is a common problem when sketches are written as a monolithic sketch and not built up incrementally. I suggest you start with a minimal sketch that solves the smallest part of your problem that you can identify, test that and get it working, and then gradually add in additional features, testing each one as you go. For example, do you know how to send a single SMS? Can you do it successfully with your hardware?
27  Using Arduino / Programming Questions / Re: Java send data to arduino. on: July 29, 2014, 07:56:19 am
I am just confused on how get arduino to listen on port 80 for that byte?

I assume you mean TCP port 80.

Just look at any of the example web server sketches. You haven't given much detail about the protocol you're going to use but I guess you're planning to send just a single byte, with a client ID encoded in the top four bits and a command state encoded in the bottom four bits. That's perfectly feasible. The fact that the client is written in Java is not a problem as long as you are capable of coding to the Java socket API.
28  Using Arduino / Project Guidance / Re: Simulating a touch on a touch screen with an arduino on: July 29, 2014, 07:47:21 am
There are extensive test tools to do this sort of thing for Android - perhaps you will find similar ones available for iOS.
29  Using Arduino / Programming Questions / Re: parrot drone 2 conversion to rc on: July 28, 2014, 11:18:54 am
This sounds like a question for a forum that deals with Parrot Drones, or drones in general, or RC systems.
30  Using Arduino / Project Guidance / Re: Gimbal servo output for horizontal vertical readout , kk2.0 +APC220+arduino on: July 28, 2014, 11:14:31 am
serial true air wil this be safe enough  ?

This is the only part of your post that looks anything like a question, and I have no idea what you're trying to ask.

If you just want to showcase your accomplishments, you would be better off posting in the Exhibition / Gallery section - or perhaps on a drone forum.
Pages: 1 [2] 3 4 ... 840