Basic webpage to show operation of Adafruit 10DOF on Renesas GR Peach board.

Dependents:   GR-PeachAHRSWeb

page3.h

Committer:
webOnBoard
Date:
2015-10-07
Revision:
0:256cd901cbb1

File content as of revision 0:256cd901cbb1:

//PAGE 3
const char *ahrsxml = "\
 <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\r\
 <AHRS>\n\r\
    <DATA>\n\r\
        <ALTITUDE>%d</ALTITUDE>\n\r\
        <HORIZONTAL>%f</HORIZONTAL>\n\r\
        <VERTICAL>%f</VERTICAL>\n\r\
        <HEADING>%d</HEADING>\n\r\
        <SWITCH1>%d</SWITCH1>\n\r\
        <SWITCH2>%d</SWITCH2>\n\r\
    </DATA>\n\r\
 </AHRS>\n\r\
 \n\r\
";

const char *RespondGetOK = "HTTP/1.1 200 OK\r\n\
                             Server: GR-PEACH-WEBSERVER\r\n\
                             Content-Type: text/html\r\n\r\n";
const char *RespondxmlOK = "HTTP/1.1 200 OK\r\n\
                             Server: GR-PEACH-WEBSERVER\r\n\
                             Content-Type: text/xml\r\n\r\n";

const char *Page3 = "\
 <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\
 <html xmlns=\"http://www.w3.org/1999/xhtml\">\
 <script>\
 var color = 'orange';\
 function drawBall()\
 {\
 var canvas = document.getElementById('ball');\
 var ctx = canvas.getContext('2d');\
 var raf;\
 var ball = {\
   x: 100,\
   y: 100,\
   vx: 5,\
   vy: 2,\
   radius: 25,\
   draw: function() {\
     ctx.beginPath();\
     ctx.arc(this.x, this.y, this.radius, 0, Math.PI*2, true);\
     ctx.closePath();\
     ctx.fillStyle = color;\
     ctx.fill();\
    ctx.lineWidth = 3;\
     ctx.strokeStyle = '#000000';\
     ctx.stroke();\
   }\
 };\
 var horizontal = 5;\
 var vertical = 2;\
 function draw() {\
   ctx.clearRect(0,0, canvas.width, canvas.height);\
   ball.draw();\
   ball.x += horizontal; //ball.vx;\
   ball.y += vertical; //ball.vy;\
   if (ball.y + ball.vy > canvas.height || ball.y + ball.vy < 0) {\
   ball.vy = -ball.vy;\
 }\
 if (ball.x + ball.vx > canvas.width || ball.x + ball.vx < 0) {\
   ball.vx = -ball.vx;\
 }\
   raf = window.requestAnimationFrame(draw);\
 }\
   raf = window.requestAnimationFrame(draw);\
 }\
 </script>\
 <head>\
 <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\
 <title>WEB SERVER</title>\
 <style type=\"text/css\">\
 .style1 {\
    text-align: center;\
 }\
 .style2 {\
    text-align: center;\
    font-size: large;\
 }\
 </style>\
 </head>\
 <body onload=\"updatePage();Load_state()\">\
 <p class=\"style2\"><strong>WELCOME TO GR-PEACH WEBSERVER</strong></p>\
 <p class=\"style1\">&nbsp;</p>\
 <table width=\"330\" border=\"1\" align=\"center\">\
   <tr>\
     <td width=\"318\" class=\"style1\" align=\"center\"><canvas id=\"ball\" width=\"400\" height=\"200\"></canvas><script>drawBall();</script></td>\
   </tr>\
 </table>\
 </body>\
 </html>\
";