I have a lever/joystick that can be pulled manually, which gives a value range between (0 to 250) depending on the percentage of how much it has been pulled. This serves as my input to the C code. The C code should give a proportional value of current as the output in the range of 0 to 2000 mA. For eg.: 0 pull of joystick gives 0mA current, 250(max) pull of joystick gives 2000mA current as output, and the between values porportionally. I am unable to figure out how to design such a code in C. I was thinking maybe the code should use an equation y=mx+c, for getting continuous proportional outputs for the real time inputs. Please can someone help me with this?
How to implement a C code for getting proportional output current(mA) values with % of lever opening as the input?
86 Views Asked by SLovesToLearn At
1
There are 1 best solutions below
Related Questions in C
- How to call a C language function from x86 assembly code?
- What does: "char *argv[]" mean?
- User input sanitization program, which takes a specific amount of arguments and passes the execution to a bash script
- How to crop a BMP image in half using C
- How can I get the difference in minutes between two dates and hours?
- Why will this code compile although it defines two variables with the same name?
- Compiling eBPF program in Docker fails due to missing '__u64' type
- Why can't I use the file pointer after the first read attempt fails?
- #include Header files in C with definition too
- OpenCV2 on CLion
- What is causing the store latency in this program?
- How to refer to the filepath of test data in test sourcecode?
- 9 Digit Addresses in Hexadecimal System in MacOS
- My server TCP doesn't receive messages from the client in C
- Printing the characters obtained from the array s using printf?
Related Questions in EMBEDDED
- MSP430F5529 on the MSPEXP430F5529LP: UART is not actually transmitting despite seemingly correct setup. What is wrong?
- A FPGA Project Proposal where I can use both PS and PL
- Program doesn't run after DFU
- Sending struct through queue
- How to generate a VPI warpmap for polynomial distortion correction?
- How to present this example concept in UML: Using 2 LCD displays in C/C++
- CLion: Debug via St-Link
- Portenta H7 Baremetal Development and a Little Guidance on Embedded System Learning Roadmap
- STM32 RTC3 Mixed Mode: Writing TR resets SSR
- Unable to read value from gpio set as input
- Mbed TLS: in-place en-/decryption for OAEP doesn't seem to work
- Shared variable read from low priority thread in preemptive scheduling
- Own Pattern / framework for interfacing with components in C
- Performance Difference Between Global Variable and Local Variable in Embedded Systems
- Comparing analog signal from Electret mic with samples
Related Questions in SOFTWARE-DESIGN
- how to measure Software as a services performace
- Why does the main function returns unexpected execution result?
- How to wrap my head around Object Oriented Design
- Specifying static and dynamic sizes at compile time
- Do unused imports in java effects performance and consume memory?
- Where to put the association model -> view model?
- Why doesn't JavaScript get its own thread in common browsers?
- Am I overusing the Singleton pattern?
- ASP .NET MVC Application UML class diagram
- I want to automate a daily task, need certain info from pdf to go into specific areas of an excel file
- Small table to Big table update
- Message in side client visual basic application?
- How to deal with multiple composed/related conditions?
- Programmatically grouping and typehinting different classes
- How can I measure the quality of my software architecture?
Related Questions in CONTROL-THEORY
- Timetable same size error, but are same size
- ACADOS non-linear cost calculation
- MATLAB: Why does my Kalman filter not work for non-zero input?
- Direct and numerically robust conversion from zero-pole to state-space representation
- How do you find the window size/response time of a kiln?
- How can I extract elements from a transfer function matrix in Octave?
- Problem with System Identification of a Single-Tank Process using MATLAB and SIMULINK
- Matlab 'popov' function
- Error in formulation of a Derivative(PD) controller
- Designing a controller using C software to control the pressure(bars) in a system using current(mA) of a proportionally opening valve
- How to implement a C code for getting proportional output current(mA) values with % of lever opening as the input?
- Balance 2-wheeled robot without making it drift forward/backward
- MATLAB taking hours to solve an equation
- How to convert a state-space model to transfer function?
- Model Predictive Control (MPC) for electromechanical system
Related Questions in PID-CONTROLLER
- Laview PID.vi continues when event case is False
- PID working with sine wave as reference in simulink
- PID control action for AC reference of variable amplitude and frequency
- Simulink PID 3 output signals block
- How do I obtain the step response of this PID controller in Matlab?
- Double pid loop
- Simulink: PID Controller - difference between back-calculation and clamping for anti-windup?
- Quadcopter PID Controller for distance
- How to perform different tasks from different classes in every cycle iteration?
- Setting a Specific Formula for PID Controller in Simulink (Matlab)
- How to deal with the discontinuity of yaw angle at 180 degree
- Python GEKKO for PID Tuning
- 2D Ball Stabilization Platform
- How to apply PID controller to my problem? Pan-tilt camera tracking
- microPython attributeError in __init__
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Given the input and output ranges, this code calculates the scaling factor (m) and offset (c) for a linear equation that can calculate a proportional output from an input. This code works even when the minimum range is nonzero.
You may need to adjust the variable types and for rounding issues to suit the needs of your application.