Question

I need a program to control a valve resolution 0 to 1023 ladder

I need a program to control a valve resolution 0 to 1023 ladder

Homework Answers

Answer #1

The basic "P" term in the PID control loop sets the increase based on how far away you are from the goal:


potValue = analogRead(potPin);
currentValue = analogRead(0);
ValveValue = ValveValue + (potValue - currentValue) * Gain;
OutputValue = map(ValveValue, 0, 1023, 0, 255);
analogWrite(ValvePin, OutputValue);

Note this keeps ValveValue at high resolution (0-1023) but maps it down to 0-255 for output only. Gain may be varied to change the speed of response. Use a floating-point number because it will probably end up rather small, like 0.05.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Design a PLC program and prepare a typical I/O connection diagram and ladder logic program for...
Design a PLC program and prepare a typical I/O connection diagram and ladder logic program for the following motor control specifi cations: • A motor must be started and stopped from any one of three start/stop pushbutton stations. • Each start/stop station contains one NO start pushbutton and one NC stop pushbutton. • Motor OL contacts are to be hardwired.
I need to create a UNIX program for this assignment In this assignment, you are to...
I need to create a UNIX program for this assignment In this assignment, you are to create an "archive" utility. It is a simple way to have some version control. You've created software projects before that change and grow over time. You might have several different copies of it (let's assume that it's all in one file). Perhaps before making major changes, you make a back-up copy, in case you later decide to revert to the earlier version. The idea...
The four types of resolution response after implantation of a device/biomaterial are (i) extrusion, (ii) resorption,...
The four types of resolution response after implantation of a device/biomaterial are (i) extrusion, (ii) resorption, (iii) integration, and (iv) encapsulation. What type of resolution response occurs with each of the following device/biomaterial (note: in some case, more that one type of resolution is possible): a. Splinter b. Degradable tissue engineering scaffold c. Titanium bone screw d. Degradable meniscal arrow (used to repair meniscal tears) e. Breast implant f. Artificial heart valve leaflet g. Catheter h. Surface scar tissue (scab)
I am trying to write a ladder logic diagram for two floors elevator. The elevator has...
I am trying to write a ladder logic diagram for two floors elevator. The elevator has open door, close door, optic sensor, open limit switch, close limit switch, up call, down call, elevator up and elevator down inputs. The outputs: opened door, closed door, 1st floor and 2nd floor. When call down is depressed, it has to show where the elevator at that particular time (1st floor or second floor). If it is on the first floor, the door will...
I need a c++ program for my class project. The topic for the c++ program is...
I need a c++ program for my class project. The topic for the c++ program is On Cyber Security password cracking. please keep it easy and simple. So the professor doesn't doubt on me. Advanced Thank you for your help.
I need this coded in R: I have a program that simulates a fair dice. The...
I need this coded in R: I have a program that simulates a fair dice. The program rolls a fair coin 100 times and counts the number of 1's. The simulation is repeated 10^5 times and stored the outcomes in x and a histogram is plotted. I need to now draw a bell curve showing normal/gaussian distribution over the histogram. Code I have: dice <- function(n) { sample(c(1:6),n,replace = TRUE) } x<-dice(100) x<-numeric(10^5) for(n in 1:10^5){ x[n]<-sum(dice(100)==1) } hist(x, main="100...
Objective: The objective of this practical exercise is to introduce to develop a ladder diagram from...
Objective: The objective of this practical exercise is to introduce to develop a ladder diagram from a word problem using interlocking and safety operation techniques. Equipment: ·         Computer with installed software to control and program the PLC Process Application: Water Tank Level The process shown in the Figure below is to be used to control the level of water in a storage tank by turning a discharge pump on or off. The modes of operation are to be programmed as...
Do While loop on C++ I need to program a do while loop in which the...
Do While loop on C++ I need to program a do while loop in which the user have to choose between option A,a, B,b or C,c. I need a do while loop that if other letter (different from options is choose) the loop print a cout saying "Invalid selection. Plese, enter the selection again.   I have one, but isn't working well int main() { char option; do { cout<<"Please choose one of the following options: "<<endl<<endl; cout<<"Option A - Julian...
I NEED A JAVA PROGRAM TO IMPLEMENT THE CONCEPT OF INDEX, if we have an DB...
I NEED A JAVA PROGRAM TO IMPLEMENT THE CONCEPT OF INDEX, if we have an DB file has a records of students number and names like this (Student file) stNum**stName 1 jack 2 maya 3 sam 4 alex 5 jane . . . . . . this file may have a thousands records, if we want to search for a specific record(student), we need to find it by (Index file), in this index file we have this (Index file) stNum**Address...
I need python code for this. Write a program that inputs a text file. The program...
I need python code for this. Write a program that inputs a text file. The program should print the unique words in the file in alphabetical order. Uppercase words should take precedence over lowercase words. For example, 'Z' comes before 'a'. The input file can contain one or more sentences, or be a multiline list of words. An example input file is shown below: example.txt the quick brown fox jumps over the lazy dog An example of the program's output...