Reading a Freestyle Blood Glucose Meter with MATLAB

Here’s some MATLAB code that will read data from a Freestyle blood glucose meter that is attached to your computer via serial cable. (Be sure to replace the “smart” quotes with appropriate single quotes. And the “…”, too. Sorry.)

% Jeff Mather - 3 October 2001 % Connect to meter. s = serial('com1', 'baudrate', 19200, ...            'FlowControl', 'Software'); fopen(s); % Initiate communication. fprintf(s, 'mem'); fprintf(s, 'log250'); % Read diagnostics. fgetl(s);   % First line is empty. meter_ID     = fgetl(s); software_ver = fgetl(s); current_time = fgetl(s); num_readings = str2num(fgetl(s)); for p = 1:num_readings     reading = fgetl(s);     sprintf(reading)         pause(0.25);     end fclose(s);
This entry was posted in Computing, Data-betes, Diabetes, Fodder for Techno-weenies, MATLAB. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>