Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

% Now we normalize the current flex reading to a range between 0 and % 2 5 5 . Let's compare ratios ( in this

% Now we normalize the current flex reading to a range between 0 and
%255. Let's compare ratios (in this case, read reflects our ADC, and
% targ reflects the RGB range) This is called linear interpolation:
%(readVal - readMin)/(readMax - readMin)=(targVal - targMin)/(targMax - targMin)
% Rearranging:
% targVal =((readVal - readMin)/(readMax - readMin))*(targMax - targMin)+ targMin
% Now let's take a reading from the flex sensor. We want to ensure our
% value is within the range we declared in order for our linear
% interpolation to work.
flexVal = nb.analogRead('A1');
if flexVal > flexMax % if flex reading is greater than maximum reading
flexVal = flexMax; % set to what?
elseif flexVal < flexMin % if flex reading is less than minimum reading
flexVal = flexMin; % set to what?
end
% Time to linearly interpolate the RGB value from our flex reading.
rawRGB =(('?'-'?')/('?'-'?'))*('?'-'?')+'?';

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Knowledge Discovery In Databases

Authors: Animesh Adhikari, Jhimli Adhikari

1st Edition

3319132121, 9783319132129

More Books

Students also viewed these Databases questions