%UpdateHTML

%write the current temp, the fan status and the time vs temp graph to

%the file temperature.html

 

%open the HTML file for writting

fid=fopen('c:\brian\school\ee476\final\web\temperature.html','w');

 

%intro

fprintf(fid,'<html>\n');

fprintf(fid,'<head>\n');

fprintf(fid,'<title>EE476 Final Project</title>\n');

fprintf(fid,'<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">\n');

fprintf(fid,'</head>\n');

 

%body

fprintf(fid,'<body bgcolor="#0000CC" text="#FFFFFF">\n');

fprintf(fid,'<center>\n');

fprintf(fid,'<pre><img src="ee476title.gif" width="397" height="80"></pre>\n');

fprintf(fid,'<p><font face="Georgia, Times New Roman, Times, serif" size="+2">Last Updated = ');

 

%output current date

temp = DATESTR(NOW);

fprintf(fid,temp);

fprintf(fid,'</font></p>\n');

fprintf(fid,'<p><font face="Georgia, Times New Roman, Times, serif" size="+2">Current Temperature = ');

 

%output current temp

temp =newTempData(1)*100+newTempData(2)*10+newTempData(3);

fprintf(fid,'%3.1f',temp);

fprintf(fid,' °C</font></p>\n');

fprintf(fid,'<p><font face="Georgia, Times New Roman, Times, serif" size="+2">Fan Status = ');

 

%check fan status bit

if (newTempData(4))

   fprintf(fid,'<i>0n</i></p>\n');

   fprintf(fid,'</font><img src="fanon.gif" width="109" height="108" align="middle">\n');

else

   fprintf(fid,'<i>0ff</i></p>\n');

   fprintf(fid,'</font><img src="fanoff.jpg" width="109" height="108" align="middle">\n');

end

 

%display the graph

fprintf(fid,'<p>&nbsp;</p>\n');

fprintf(fid,'<p><font face="Georgia, Times New Roman, Times, serif" size="+1">Time Plot of Temperature</font></p>');

fprintf(fid,'<p><img src="tempGraph.jpg" width="560" height="420"> </p>');

fprintf(fid,'</center>\n');

 

%end the html file

fprintf(fid,'</body>');

fprintf(fid,'</body>');

 

%close the file

fclose(fid);