Question: % 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!