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.
I need a Flowchart and Code for the following Java Program Write a method that converts...
I need a Flowchart and Code for the following Java Program Write a method that converts milliseconds to hours, minutes, and seconds using the following header: public static String convertMillis(long millis) The method returns a string as hours:minutes:seconds. For example,convertMillis(5500) returns a string 0:0:5, convertMillis(100000) returns a string 0:1:40, and convertMillis(555550000) returns a string 154:19:10. Write a test program that prompts the user to enter a long integer for milliseconds and displays a string in the format of hours:minutes:seconds.
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...
I need a few unit tests done on my SelectionSort program in Visual Studio 2019 with...
I need a few unit tests done on my SelectionSort program in Visual Studio 2019 with MSTest. My program is below. I just need screen shots of the unit test code in Visual Studio 2019 with MSTest. Please and thank you. using System; namespace SelectionSortAlgorithm { public class SelectionSort { public static void Main(string[] args) { int[] dataSet = new int[5] { 2, 99, 27, 68, 3 }; // 5 element array initialized int n = 5; // variable declar...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT