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.
This is the program that I need to make. Write a program that prints three items,...
This is the program that I need to make. Write a program that prints three items, such as the names of your three best friends or favorite movies, on three separate lines. This is what I did. #include <iostream> using namespace std; int main() { cout << "Suresh" << endl; cout << "Sekhar" << endl; cout << "Anshu" << endl; return 0; } Then it tells me that the program fails to test the submission with three random names. Please...
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 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...
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.
Given the following code snippet, what is this program calculating? for (int i = 0; i...
Given the following code snippet, what is this program calculating? for (int i = 0; i < n; i++) { sum += arr[i]; } sum /= n;
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...
describe the output that will be generated by this basic program Let x=0 FOR i =...
describe the output that will be generated by this basic program Let x=0 FOR i = 0 to 4 FOR j = 0 to i-1 LET k = (i+j-1) IF (k MOD 2=0) THEN       LET x= x+k     ELSE IF(k MOD 3 = 0) THEN     LET x=x+k-2 END IF PRINT X NEXT J NEXT I END
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...