Hello,
I am currently working on a project for my lab and given the fact that I am a noob, I need some guidance.
I will be using a syringe pump (https://hackaday.io/project/1838-open-syringe-pump) same concept but no LCDs or User direct control to dispense different liquids. What I need to do is that :
User will Select Container 1.
User will add as many function as they want to the system using the arduino connected to wifi with wishield.
Functions Will be as following:
Dispense X amount of liquid 1.
Dispense Y amount of liquid 2
Dispense Z amount of liquid 3...
I really don't have any questions about the programming actual thing with steppers, servos and all that.
I just don't know how to set the program so that I will have several different functions with variables that will be called when they are needed to. What I am trying to say is.. i know how many steps the stepper motor needs to take to dispense the required amount of media, I just don't know how to write program so that user will define the X and the arduino responds accordingly. Or if the user wishes to shake the platform add liquid 1, liquid 2 shake, liquid 1 and liquid 3 again.. Like i know how to make the physical things work just don't know how to systematically call them and change them according to wifi input.
Simplify the problem by using (hypothetical) switches instead of wifi input. When a switch is pressed by the user, a flag (variable) is set, which governs program flow in loop(). Later on the variables will be set by wifi input.
Now you'll need variables for the parameters (which liquid, how much...), and one for the command that starts dispensing, shaking or whatsoever. Write the code to execute the commands.
Finally define a protocol for sending parameters and commands by wifi. You can use a Serial connection and terminal window for debugging the handling of the input.
You may have to prevent command and parameter override, when the next action should start only after completion of the previous one. In this case a "ready" message may be sent back to the input device.
Mr_Intro:
I just don't know how to set the program so that I will have several different functions with variables that will be called when they are needed to. What I am trying to say is.. i know how many steps the stepper motor needs to take to dispense the required amount of media, I just don't know how to write program so that user will define the X and the arduino responds accordingly. Or if the user wishes to shake the platform add liquid 1, liquid 2 shake, liquid 1 and liquid 3 again.. Like i know how to make the physical things work just don't know how to systematically call them and change them according to wifi input.
You need to explain your requirement more clearly if someone who knows nothing about it is to be able to suggest code for it.
Think about the steps needed to specify one product on its own. Then think about how that could be extended to multiple products. I suspect a large part of the project will be defining a suitable format for keeping track of the data. I like to think of projects having two sides. One side puts data into some variables. The other side uses the data. The data is the only link between the two sides.
Hello,
As it says in the title I am trying to set functions in order according to input.
For example:
If user wants to dispense liquid 1, then liquid 3 then shake the platform...
another user wants to dispense liquid 2 shake and shake, and then add liquid 4...
How do I make it so that the user will define from a drop down menu for example select the steps, add or subtract steps as they please and run them?
Thank you.
What code have you written? It sounds like you want a queue of steps. As the user defines things to do, push them onto the queue. As a step ends, pop the next thing to do off the queue, and do it, until the queue is empty.
Some commands to show the queue and to dump the queue are probably in order.
Mr_Intro:
How do I make it so that the user will define from a drop down menu for example select the steps, add or subtract steps as they please and run them?
Essentially you want to create and use a script (batch file). This can be implemented on the other device, that sends the commands to the Arduino by wifi.
Robin2:
I can't help unless to tell us what you did not understand.
...R
So I will try to explain in more detail.
I want to construct a basic HTML page using wifly shield that I have.
In that HTML page there are going to be 10 steps that the user will identify from the drop box menu. The thing where when you click gives you options like selecting your country or hovering your mouse over to products at arduino's Products category and lists Arduino (USA only) , Outside USA etc etc... Now each of these functions need to have another box right next to them to define the variable of the function. This variable needs to go to the function that has been selected by the user from the drop box menu. For example the drop box menu will have these options..
Also this..
Drop Box Item selected [Now this text box is where user will put for example 50 for 50 mL of media that needs to be dispensed from the selected liquid or the seconds the platform will be shaked]
After defining functions and amounts I need to put them in order. I was planning on having a number for each of my functions and make the drop box inputs to create an array.
So Dispense liquid 1 will have the function number 1
Liquid 2 and so on.
So if the chooser selects liquid 2 , 3 and shake in this order out of this 10 steps and leaves the rest empty,
the machine will add liquid 2 then 3 then shake.
Amount of liquids that is going to be dispensed and time will be determined by the text boxes right next to them.
I hope this will help you helping me.. Thanks so much
Are you thinking of hosting the HTML server on an Arduino?
I have never understood the rationale behind that unless the web page is very very simple. Web pages need large amounts of text and the Arduino is not ideal for that.
It is so much easier to do web programming on a PC with proper "tools" such as Bottle. Have you considered using a Yun, a Yun shield or a RaspberryPI connect to an Arduino so you can do the web stuff (and more) in Linux.
Then your Linux program can sort out all the complexities and send some simple instruction to the Arduino to dispense liquids and shake them.
Mr_Intro:
So yeah web page is going to very very simple. A few texts and custom boxes. Nothing fancy
Based on your Reply #10 I can't help feeling I have a totally different concept of "very simple"
Have you tried out your HTML code on a PC? (Just create a HTML file with your text editor and view it in your browser - so you can see how much text is involved)