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

Dependents:   GR-PeachAHRSWeb

Committer:
webOnBoard
Date:
Wed Oct 07 20:34:51 2015 +0000
Revision:
0:256cd901cbb1
First release of AHRS web demo

Who changed what in which revision?

UserRevisionLine numberNew contents of line
webOnBoard 0:256cd901cbb1 1 #ifndef WEBPAGE_H
webOnBoard 0:256cd901cbb1 2 #define WEBPAGE_H
webOnBoard 0:256cd901cbb1 3 //
webOnBoard 0:256cd901cbb1 4 #ifdef __cplusplus
webOnBoard 0:256cd901cbb1 5 extern "C" {
webOnBoard 0:256cd901cbb1 6 #endif
webOnBoard 0:256cd901cbb1 7
webOnBoard 0:256cd901cbb1 8 /
webOnBoard 0:256cd901cbb1 9
webOnBoard 0:256cd901cbb1 10
webOnBoard 0:256cd901cbb1 11 //PAGE 3
webOnBoard 0:256cd901cbb1 12 char ahrsxml[] = {
webOnBoard 0:256cd901cbb1 13 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\r"
webOnBoard 0:256cd901cbb1 14 "<AHRS>\n\r"
webOnBoard 0:256cd901cbb1 15 " <DATA>\n\r"
webOnBoard 0:256cd901cbb1 16 " <ALTITUDE>%d</ALTITUDE>\n\r"
webOnBoard 0:256cd901cbb1 17 " <HORIZONTAL>%f</HORIZONTAL>\n\r"
webOnBoard 0:256cd901cbb1 18 " <VERTICAL>%f</VERTICAL>\n\r"
webOnBoard 0:256cd901cbb1 19 " <HEADING>%d</HEADING>\n\r"
webOnBoard 0:256cd901cbb1 20 " <SWITCH1>%d</SWITCH1>\n\r"
webOnBoard 0:256cd901cbb1 21 " <SWITCH2>%d</SWITCH2>\n\r"
webOnBoard 0:256cd901cbb1 22 " </DATA>\n\r"
webOnBoard 0:256cd901cbb1 23 "</AHRS>\n\r"
webOnBoard 0:256cd901cbb1 24 "\n\r"
webOnBoard 0:256cd901cbb1 25 };
webOnBoard 0:256cd901cbb1 26
webOnBoard 0:256cd901cbb1 27 char RespondGetOK[] = {"HTTP/1.1 200 OK\r\n"
webOnBoard 0:256cd901cbb1 28 "Server: GR-PEACH-WEBSERVER\r\n"
webOnBoard 0:256cd901cbb1 29 "Content-Type: text/html\r\n\r\n"};
webOnBoard 0:256cd901cbb1 30 char RespondxmlOK[] = {"HTTP/1.1 200 OK\r\n"
webOnBoard 0:256cd901cbb1 31 "Server: GR-PEACH-WEBSERVER\r\n"
webOnBoard 0:256cd901cbb1 32 "Content-Type: text/xml\r\n\r\n"};
webOnBoard 0:256cd901cbb1 33
webOnBoard 0:256cd901cbb1 34 char Page3[] = {
webOnBoard 0:256cd901cbb1 35 "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"
webOnBoard 0:256cd901cbb1 36 "<html xmlns=\"http://www.w3.org/1999/xhtml\">"
webOnBoard 0:256cd901cbb1 37 "<head>"
webOnBoard 0:256cd901cbb1 38 "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />"
webOnBoard 0:256cd901cbb1 39 "<title>WEB SERVER</title>"
webOnBoard 0:256cd901cbb1 40 "<script>"
webOnBoard 0:256cd901cbb1 41 "function updateStatus()"
webOnBoard 0:256cd901cbb1 42 "{"
webOnBoard 0:256cd901cbb1 43 " CheckButtonPress(); "
webOnBoard 0:256cd901cbb1 44 "}"
webOnBoard 0:256cd901cbb1 45 "function updatePage()"
webOnBoard 0:256cd901cbb1 46 "{"
webOnBoard 0:256cd901cbb1 47 " var intervalID = setInterval(updateStatus, 1500);"
webOnBoard 0:256cd901cbb1 48 "}"
webOnBoard 0:256cd901cbb1 49 "function CheckButtonPress()"
webOnBoard 0:256cd901cbb1 50 "{"
webOnBoard 0:256cd901cbb1 51 " var req = false;"
webOnBoard 0:256cd901cbb1 52 " if(window.XMLHttpRequest)"
webOnBoard 0:256cd901cbb1 53 " {"
webOnBoard 0:256cd901cbb1 54 " req = new XMLHttpRequest();"
webOnBoard 0:256cd901cbb1 55 " }"
webOnBoard 0:256cd901cbb1 56 " else if(window.ActiveXObject)"
webOnBoard 0:256cd901cbb1 57 " {"
webOnBoard 0:256cd901cbb1 58 " req = new ActiveXObject(\"Microsoft.XMLHTTP\");"
webOnBoard 0:256cd901cbb1 59 " }"
webOnBoard 0:256cd901cbb1 60 /*" function Update()"
webOnBoard 0:256cd901cbb1 61 " {"
webOnBoard 0:256cd901cbb1 62 " if(req.readyState == 4)"
webOnBoard 0:256cd901cbb1 63 " {"
webOnBoard 0:256cd901cbb1 64 " if(req.status == 200)"
webOnBoard 0:256cd901cbb1 65 " { "
webOnBoard 0:256cd901cbb1 66 " var text;"
webOnBoard 0:256cd901cbb1 67 " text = req.responseText;"
webOnBoard 0:256cd901cbb1 68 " var cmp = text.localeCompare(\"ON\"); "
webOnBoard 0:256cd901cbb1 69 " if (cmp == 0)"
webOnBoard 0:256cd901cbb1 70 " {"
webOnBoard 0:256cd901cbb1 71 " color='purple';"
webOnBoard 0:256cd901cbb1 72 " }"
webOnBoard 0:256cd901cbb1 73 " else"
webOnBoard 0:256cd901cbb1 74 " {"
webOnBoard 0:256cd901cbb1 75 " color='orange';"
webOnBoard 0:256cd901cbb1 76 " }"
webOnBoard 0:256cd901cbb1 77 " }"
webOnBoard 0:256cd901cbb1 78 " }"
webOnBoard 0:256cd901cbb1 79 " } "*/
webOnBoard 0:256cd901cbb1 80 " if(req)"
webOnBoard 0:256cd901cbb1 81 " {"
webOnBoard 0:256cd901cbb1 82 " req.open(\"GET\",\"AHRS.xml\",false);"
webOnBoard 0:256cd901cbb1 83 " req.send();"
webOnBoard 0:256cd901cbb1 84 " xmlDoc=req.responseXML;"
webOnBoard 0:256cd901cbb1 85 " x=xmlDoc.getElementsByTagName(\"DATA\");"
webOnBoard 0:256cd901cbb1 86 //" function paintBall()"
webOnBoard 0:256cd901cbb1 87 //" {"
webOnBoard 0:256cd901cbb1 88 " color=(x[0].getElementsByTagName(\"COLOR\")[0].childNodes[0].nodeValue);"
webOnBoard 0:256cd901cbb1 89 " horizontal=(x[0].getElementsByTagName(\"HORIZONTAL\")[0].childNodes[0].nodeValue);"
webOnBoard 0:256cd901cbb1 90 " vertical=(x[0].getElementsByTagName(\"VERTICAL\")[0].childNodes[0].nodeValue);"
webOnBoard 0:256cd901cbb1 91 //" }"
webOnBoard 0:256cd901cbb1 92 //" req.open(\"POST\", \"/isbuttonpress?id\" + Math.random(), true);"
webOnBoard 0:256cd901cbb1 93 //" req.onreadystatechange = Update;"
webOnBoard 0:256cd901cbb1 94 //" req.send();"
webOnBoard 0:256cd901cbb1 95 " } "
webOnBoard 0:256cd901cbb1 96 "}"
webOnBoard 0:256cd901cbb1 97 "function Load_state()"
webOnBoard 0:256cd901cbb1 98 "{"
webOnBoard 0:256cd901cbb1 99 " var acload = false;"
webOnBoard 0:256cd901cbb1 100 " function Update()"
webOnBoard 0:256cd901cbb1 101 " {"
webOnBoard 0:256cd901cbb1 102 " if(acload.readyState == 4)"
webOnBoard 0:256cd901cbb1 103 " {"
webOnBoard 0:256cd901cbb1 104 " if(acload.status == 200)"
webOnBoard 0:256cd901cbb1 105 " {"
webOnBoard 0:256cd901cbb1 106 " var text;"
webOnBoard 0:256cd901cbb1 107 " text = acload.responseText;"
webOnBoard 0:256cd901cbb1 108 " var ledred;"
webOnBoard 0:256cd901cbb1 109 " var ledgreen;"
webOnBoard 0:256cd901cbb1 110 " var ledblue;"
webOnBoard 0:256cd901cbb1 111 " ledred = text.slice(0,2);"
webOnBoard 0:256cd901cbb1 112 " ledgreen = text.slice(3,5);"
webOnBoard 0:256cd901cbb1 113 " ledblue = text.slice(6,8); "
webOnBoard 0:256cd901cbb1 114 " var cmpred = ledred.localeCompare(\"ON\");"
webOnBoard 0:256cd901cbb1 115 " if (cmpred == 0)"
webOnBoard 0:256cd901cbb1 116 " {"
webOnBoard 0:256cd901cbb1 117 " drawLedOn('redled','red');"
webOnBoard 0:256cd901cbb1 118 " document.getElementById(\"onoffred\").value = \"OFF\";"
webOnBoard 0:256cd901cbb1 119 " }"
webOnBoard 0:256cd901cbb1 120 " else if (cmpred == -1)"
webOnBoard 0:256cd901cbb1 121 " {"
webOnBoard 0:256cd901cbb1 122 " drawLedOff('redled');"
webOnBoard 0:256cd901cbb1 123 " document.getElementById(\"onoffred\").value = \"ON\";"
webOnBoard 0:256cd901cbb1 124 " }"
webOnBoard 0:256cd901cbb1 125 " var cmpgreen = ledgreen.localeCompare(\"ON\");"
webOnBoard 0:256cd901cbb1 126 " if (cmpgreen == 0)"
webOnBoard 0:256cd901cbb1 127 " {"
webOnBoard 0:256cd901cbb1 128 " drawLedOn('greenled','green');"
webOnBoard 0:256cd901cbb1 129 " document.getElementById(\"onoffgreen\").value = \"OFF\";"
webOnBoard 0:256cd901cbb1 130 " }"
webOnBoard 0:256cd901cbb1 131 " else if (cmpgreen == -1)"
webOnBoard 0:256cd901cbb1 132 " {"
webOnBoard 0:256cd901cbb1 133 " drawLedOff('greenled');"
webOnBoard 0:256cd901cbb1 134 " document.getElementById(\"onoffgreen\").value = \"ON\";"
webOnBoard 0:256cd901cbb1 135 " }"
webOnBoard 0:256cd901cbb1 136 " var cmpblue = ledblue.localeCompare(\"ON\");"
webOnBoard 0:256cd901cbb1 137 " if (cmpblue == 0)"
webOnBoard 0:256cd901cbb1 138 " {"
webOnBoard 0:256cd901cbb1 139 " drawLedOn('blueled','blue');"
webOnBoard 0:256cd901cbb1 140 " document.getElementById(\"onoffblue\").value = \"OFF\";"
webOnBoard 0:256cd901cbb1 141 " }"
webOnBoard 0:256cd901cbb1 142 " else if (cmpblue == -1)"
webOnBoard 0:256cd901cbb1 143 " {"
webOnBoard 0:256cd901cbb1 144 " drawLedOff('blueled');"
webOnBoard 0:256cd901cbb1 145 " document.getElementById(\"onoffblue\").value = \"ON\";"
webOnBoard 0:256cd901cbb1 146 " }"
webOnBoard 0:256cd901cbb1 147 " }"
webOnBoard 0:256cd901cbb1 148 " }"
webOnBoard 0:256cd901cbb1 149 " }"
webOnBoard 0:256cd901cbb1 150 " if(window.XMLHttpRequest)"
webOnBoard 0:256cd901cbb1 151 " {"
webOnBoard 0:256cd901cbb1 152 " acload = new XMLHttpRequest();"
webOnBoard 0:256cd901cbb1 153 " }"
webOnBoard 0:256cd901cbb1 154 " else if(window.ActiveXObject)"
webOnBoard 0:256cd901cbb1 155 " {"
webOnBoard 0:256cd901cbb1 156 " acload = new ActiveXObject(\"Microsoft.XMLHTTP\");"
webOnBoard 0:256cd901cbb1 157 " }"
webOnBoard 0:256cd901cbb1 158 " if(acload)"
webOnBoard 0:256cd901cbb1 159 " {"
webOnBoard 0:256cd901cbb1 160 " acload.open(\"GET\", \"/acloadstate?id=\" + Math.random(), true);"
webOnBoard 0:256cd901cbb1 161 " acload.onreadystatechange = Update;"
webOnBoard 0:256cd901cbb1 162 " acload.send(null); "
webOnBoard 0:256cd901cbb1 163 " }"
webOnBoard 0:256cd901cbb1 164 "}"
webOnBoard 0:256cd901cbb1 165 "function LedRedChange()"
webOnBoard 0:256cd901cbb1 166 "{"
webOnBoard 0:256cd901cbb1 167 " var req = false;"
webOnBoard 0:256cd901cbb1 168 " if(window.XMLHttpRequest)"
webOnBoard 0:256cd901cbb1 169 " {"
webOnBoard 0:256cd901cbb1 170 " req = new XMLHttpRequest();"
webOnBoard 0:256cd901cbb1 171 " }"
webOnBoard 0:256cd901cbb1 172 " else if(window.ActiveXObject)"
webOnBoard 0:256cd901cbb1 173 " {"
webOnBoard 0:256cd901cbb1 174 " req = new ActiveXObject(\"Microsoft.XMLHTTP\");"
webOnBoard 0:256cd901cbb1 175 " }"
webOnBoard 0:256cd901cbb1 176 " function Update()"
webOnBoard 0:256cd901cbb1 177 " {"
webOnBoard 0:256cd901cbb1 178 " if(req.readyState == 4)"
webOnBoard 0:256cd901cbb1 179 " {"
webOnBoard 0:256cd901cbb1 180 " if(req.status == 200)"
webOnBoard 0:256cd901cbb1 181 " { "
webOnBoard 0:256cd901cbb1 182 " var text;"
webOnBoard 0:256cd901cbb1 183 " text = req.responseText;"
webOnBoard 0:256cd901cbb1 184 " var cmp = text.localeCompare(\"ONRED\"); "
webOnBoard 0:256cd901cbb1 185 " if (cmp == 0)"
webOnBoard 0:256cd901cbb1 186 " {"
webOnBoard 0:256cd901cbb1 187 " drawLedOn('redled','red');"
webOnBoard 0:256cd901cbb1 188 " document.getElementById(\"onoffred\").value = \"OFF\";"
webOnBoard 0:256cd901cbb1 189 " }"
webOnBoard 0:256cd901cbb1 190 " else if (cmp == -1)"
webOnBoard 0:256cd901cbb1 191 " {"
webOnBoard 0:256cd901cbb1 192 " drawLedOff('redled');"
webOnBoard 0:256cd901cbb1 193 " document.getElementById(\"onoffred\").value = \"ON\";"
webOnBoard 0:256cd901cbb1 194 " }"
webOnBoard 0:256cd901cbb1 195 " }"
webOnBoard 0:256cd901cbb1 196 " }"
webOnBoard 0:256cd901cbb1 197 " }"
webOnBoard 0:256cd901cbb1 198 " if(document.getElementById(\"onoffred\").value == \"ON\")"
webOnBoard 0:256cd901cbb1 199 " { "
webOnBoard 0:256cd901cbb1 200 " if(req)"
webOnBoard 0:256cd901cbb1 201 " {"
webOnBoard 0:256cd901cbb1 202 " req.open(\"POST\", \"/LEDRED=ON?id\" + Math.random(), true);"
webOnBoard 0:256cd901cbb1 203 " req.onreadystatechange = Update;"
webOnBoard 0:256cd901cbb1 204 " req.send();"
webOnBoard 0:256cd901cbb1 205 " }"
webOnBoard 0:256cd901cbb1 206 " }"
webOnBoard 0:256cd901cbb1 207 " else"
webOnBoard 0:256cd901cbb1 208 " {"
webOnBoard 0:256cd901cbb1 209 " if(req)"
webOnBoard 0:256cd901cbb1 210 " {"
webOnBoard 0:256cd901cbb1 211 " req.open(\"POST\", \"/LEDRED=OFF?id\" + Math.random(), true);"
webOnBoard 0:256cd901cbb1 212 " req.onreadystatechange = Update; "
webOnBoard 0:256cd901cbb1 213 " req.send(); "
webOnBoard 0:256cd901cbb1 214 " }"
webOnBoard 0:256cd901cbb1 215 " } "
webOnBoard 0:256cd901cbb1 216 "}"
webOnBoard 0:256cd901cbb1 217 "function LedGreenChange()"
webOnBoard 0:256cd901cbb1 218 "{"
webOnBoard 0:256cd901cbb1 219 " var req = false;"
webOnBoard 0:256cd901cbb1 220 " if(window.XMLHttpRequest)"
webOnBoard 0:256cd901cbb1 221 " {"
webOnBoard 0:256cd901cbb1 222 " req = new XMLHttpRequest();"
webOnBoard 0:256cd901cbb1 223 " }"
webOnBoard 0:256cd901cbb1 224 " else if(window.ActiveXObject)"
webOnBoard 0:256cd901cbb1 225 " {"
webOnBoard 0:256cd901cbb1 226 " req = new ActiveXObject(\"Microsoft.XMLHTTP\");"
webOnBoard 0:256cd901cbb1 227 " }"
webOnBoard 0:256cd901cbb1 228 " function Update()"
webOnBoard 0:256cd901cbb1 229 " {"
webOnBoard 0:256cd901cbb1 230 " if(req.readyState == 4)"
webOnBoard 0:256cd901cbb1 231 " {"
webOnBoard 0:256cd901cbb1 232 " if(req.status == 200)"
webOnBoard 0:256cd901cbb1 233 " { "
webOnBoard 0:256cd901cbb1 234 " var text;"
webOnBoard 0:256cd901cbb1 235 " text = req.responseText;"
webOnBoard 0:256cd901cbb1 236 " var cmp = text.localeCompare(\"ONGREEN\"); "
webOnBoard 0:256cd901cbb1 237 " if (cmp == 0)"
webOnBoard 0:256cd901cbb1 238 " {"
webOnBoard 0:256cd901cbb1 239 " drawLedOn('greenled','green');"
webOnBoard 0:256cd901cbb1 240 " document.getElementById(\"onoffgreen\").value = \"OFF\";"
webOnBoard 0:256cd901cbb1 241 " }"
webOnBoard 0:256cd901cbb1 242 " else if (cmp == -1)"
webOnBoard 0:256cd901cbb1 243 " {"
webOnBoard 0:256cd901cbb1 244 " drawLedOff('greenled');"
webOnBoard 0:256cd901cbb1 245 " document.getElementById(\"onoffgreen\").value = \"ON\";"
webOnBoard 0:256cd901cbb1 246 " }"
webOnBoard 0:256cd901cbb1 247 " }"
webOnBoard 0:256cd901cbb1 248 " }"
webOnBoard 0:256cd901cbb1 249 " }"
webOnBoard 0:256cd901cbb1 250 " if(document.getElementById(\"onoffgreen\").value == \"ON\")"
webOnBoard 0:256cd901cbb1 251 " {"
webOnBoard 0:256cd901cbb1 252 " if(req)"
webOnBoard 0:256cd901cbb1 253 " {"
webOnBoard 0:256cd901cbb1 254 " req.open(\"POST\", \"/LEDGR=ON?id\" + Math.random(), true);"
webOnBoard 0:256cd901cbb1 255 " req.onreadystatechange = Update; "
webOnBoard 0:256cd901cbb1 256 " req.send();"
webOnBoard 0:256cd901cbb1 257 " }"
webOnBoard 0:256cd901cbb1 258 " }"
webOnBoard 0:256cd901cbb1 259 " else"
webOnBoard 0:256cd901cbb1 260 " { "
webOnBoard 0:256cd901cbb1 261 " if(req)"
webOnBoard 0:256cd901cbb1 262 " {"
webOnBoard 0:256cd901cbb1 263 " req.open(\"POST\", \"/LEDGR=OFF?id\" + Math.random(), true);"
webOnBoard 0:256cd901cbb1 264 " req.onreadystatechange = Update; "
webOnBoard 0:256cd901cbb1 265 " req.send();"
webOnBoard 0:256cd901cbb1 266 " }"
webOnBoard 0:256cd901cbb1 267 " }"
webOnBoard 0:256cd901cbb1 268 "}"
webOnBoard 0:256cd901cbb1 269 "function LedBlueChange()"
webOnBoard 0:256cd901cbb1 270 "{"
webOnBoard 0:256cd901cbb1 271 " var req = false;"
webOnBoard 0:256cd901cbb1 272 " if(window.XMLHttpRequest)"
webOnBoard 0:256cd901cbb1 273 " {"
webOnBoard 0:256cd901cbb1 274 " req = new XMLHttpRequest();"
webOnBoard 0:256cd901cbb1 275 " }"
webOnBoard 0:256cd901cbb1 276 " else if(window.ActiveXObject)"
webOnBoard 0:256cd901cbb1 277 " {"
webOnBoard 0:256cd901cbb1 278 " req = new ActiveXObject(\"Microsoft.XMLHTTP\");"
webOnBoard 0:256cd901cbb1 279 " }"
webOnBoard 0:256cd901cbb1 280 " function Update()"
webOnBoard 0:256cd901cbb1 281 " {"
webOnBoard 0:256cd901cbb1 282 " if(req.readyState == 4)"
webOnBoard 0:256cd901cbb1 283 " {"
webOnBoard 0:256cd901cbb1 284 " if(req.status == 200)"
webOnBoard 0:256cd901cbb1 285 " { "
webOnBoard 0:256cd901cbb1 286 " var text;"
webOnBoard 0:256cd901cbb1 287 " text = req.responseText;"
webOnBoard 0:256cd901cbb1 288 " var cmp = text.localeCompare(\"ONBLUE\"); "
webOnBoard 0:256cd901cbb1 289 " if (cmp == 0)"
webOnBoard 0:256cd901cbb1 290 " {"
webOnBoard 0:256cd901cbb1 291 " drawLedOn('blueled','blue');"
webOnBoard 0:256cd901cbb1 292 " document.getElementById(\"onoffblue\").value = \"OFF\";"
webOnBoard 0:256cd901cbb1 293 " }"
webOnBoard 0:256cd901cbb1 294 " else if (cmp == -1)"
webOnBoard 0:256cd901cbb1 295 " {"
webOnBoard 0:256cd901cbb1 296 " drawLedOff('blueled');"
webOnBoard 0:256cd901cbb1 297 " document.getElementById(\"onoffblue\").value = \"ON\";"
webOnBoard 0:256cd901cbb1 298 " }"
webOnBoard 0:256cd901cbb1 299 " }"
webOnBoard 0:256cd901cbb1 300 " }"
webOnBoard 0:256cd901cbb1 301 " }"
webOnBoard 0:256cd901cbb1 302 " if(document.getElementById(\"onoffblue\").value == \"ON\")"
webOnBoard 0:256cd901cbb1 303 " {"
webOnBoard 0:256cd901cbb1 304 " "
webOnBoard 0:256cd901cbb1 305 " if(req)"
webOnBoard 0:256cd901cbb1 306 " {"
webOnBoard 0:256cd901cbb1 307 " req.open(\"POST\", \"/LEDBLUE=ON?id\" + Math.random(), true);"
webOnBoard 0:256cd901cbb1 308 " req.onreadystatechange = Update;"
webOnBoard 0:256cd901cbb1 309 " req.send();"
webOnBoard 0:256cd901cbb1 310 " }"
webOnBoard 0:256cd901cbb1 311 " }"
webOnBoard 0:256cd901cbb1 312 " else"
webOnBoard 0:256cd901cbb1 313 " {"
webOnBoard 0:256cd901cbb1 314 " if(req)"
webOnBoard 0:256cd901cbb1 315 " {"
webOnBoard 0:256cd901cbb1 316 " req.open(\"POST\", \"/LEDBLUE=OFF?id\" + Math.random(), true);"
webOnBoard 0:256cd901cbb1 317 " req.onreadystatechange = Update;"
webOnBoard 0:256cd901cbb1 318 " req.send();"
webOnBoard 0:256cd901cbb1 319 " }"
webOnBoard 0:256cd901cbb1 320 " }"
webOnBoard 0:256cd901cbb1 321 "}"
webOnBoard 0:256cd901cbb1 322 "function drawLedOff(id)"
webOnBoard 0:256cd901cbb1 323 "{"
webOnBoard 0:256cd901cbb1 324 " var canvas = document.getElementById(id);"
webOnBoard 0:256cd901cbb1 325 " var context = canvas.getContext('2d');"
webOnBoard 0:256cd901cbb1 326 " var centerX = canvas.width / 2;"
webOnBoard 0:256cd901cbb1 327 " var centerY = canvas.height / 2;"
webOnBoard 0:256cd901cbb1 328 " var radius = 15;"
webOnBoard 0:256cd901cbb1 329
webOnBoard 0:256cd901cbb1 330 " context.beginPath();"
webOnBoard 0:256cd901cbb1 331 " context.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);"
webOnBoard 0:256cd901cbb1 332 " context.fillStyle = 'black';"
webOnBoard 0:256cd901cbb1 333 " context.fill();"
webOnBoard 0:256cd901cbb1 334 " context.lineWidth = 5;"
webOnBoard 0:256cd901cbb1 335 " context.strokeStyle = '#cecece';"
webOnBoard 0:256cd901cbb1 336 " context.stroke();"
webOnBoard 0:256cd901cbb1 337 "}"
webOnBoard 0:256cd901cbb1 338 "function drawLedOn(id,color)"
webOnBoard 0:256cd901cbb1 339 "{"
webOnBoard 0:256cd901cbb1 340 " var canvas = document.getElementById(id);"
webOnBoard 0:256cd901cbb1 341 " var context = canvas.getContext('2d');"
webOnBoard 0:256cd901cbb1 342 " var centerX = canvas.width / 2;"
webOnBoard 0:256cd901cbb1 343 " var centerY = canvas.height / 2;"
webOnBoard 0:256cd901cbb1 344 " var radius = 15;"
webOnBoard 0:256cd901cbb1 345
webOnBoard 0:256cd901cbb1 346 " context.beginPath();"
webOnBoard 0:256cd901cbb1 347 " context.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);"
webOnBoard 0:256cd901cbb1 348 " context.fillStyle = color;"
webOnBoard 0:256cd901cbb1 349 " context.fill();"
webOnBoard 0:256cd901cbb1 350 " context.lineWidth = 3;"
webOnBoard 0:256cd901cbb1 351 " context.strokeStyle = '#000000';"
webOnBoard 0:256cd901cbb1 352 " context.stroke();"
webOnBoard 0:256cd901cbb1 353 "}"
webOnBoard 0:256cd901cbb1 354 "var color = 'orange';"
webOnBoard 0:256cd901cbb1 355 "function drawBall()"
webOnBoard 0:256cd901cbb1 356 "{"
webOnBoard 0:256cd901cbb1 357 "var canvas = document.getElementById('ball');"
webOnBoard 0:256cd901cbb1 358 "var ctx = canvas.getContext('2d');"
webOnBoard 0:256cd901cbb1 359 "var raf;"
webOnBoard 0:256cd901cbb1 360 "var ball = {"
webOnBoard 0:256cd901cbb1 361 " x: 100,"
webOnBoard 0:256cd901cbb1 362 " y: 100,"
webOnBoard 0:256cd901cbb1 363 " vx: 5,"
webOnBoard 0:256cd901cbb1 364 " vy: 2,"
webOnBoard 0:256cd901cbb1 365 " radius: 25,"
webOnBoard 0:256cd901cbb1 366 " draw: function() {"
webOnBoard 0:256cd901cbb1 367 " ctx.beginPath();"
webOnBoard 0:256cd901cbb1 368 " ctx.arc(this.x, this.y, this.radius, 0, Math.PI*2, true);"
webOnBoard 0:256cd901cbb1 369 " ctx.closePath();"
webOnBoard 0:256cd901cbb1 370 " ctx.fillStyle = color;"
webOnBoard 0:256cd901cbb1 371 " ctx.fill();"
webOnBoard 0:256cd901cbb1 372 " ctx.lineWidth = 3;"
webOnBoard 0:256cd901cbb1 373 " ctx.strokeStyle = '#000000';"
webOnBoard 0:256cd901cbb1 374 " ctx.stroke();"
webOnBoard 0:256cd901cbb1 375 " }"
webOnBoard 0:256cd901cbb1 376 "};"
webOnBoard 0:256cd901cbb1 377
webOnBoard 0:256cd901cbb1 378 "var horizontal = 5;"
webOnBoard 0:256cd901cbb1 379 "var vertical = 2;"
webOnBoard 0:256cd901cbb1 380 "function draw() {"
webOnBoard 0:256cd901cbb1 381 " ctx.clearRect(0,0, canvas.width, canvas.height);"
webOnBoard 0:256cd901cbb1 382 " ball.draw();"
webOnBoard 0:256cd901cbb1 383 " ball.x += horizontal;"
webOnBoard 0:256cd901cbb1 384 //ball.vx;"
webOnBoard 0:256cd901cbb1 385 " ball.y += vertical;"
webOnBoard 0:256cd901cbb1 386 //ball.vy;"
webOnBoard 0:256cd901cbb1 387 " if (ball.y + ball.vy > canvas.height || ball.y + ball.vy < 0) {"
webOnBoard 0:256cd901cbb1 388 " ball.vy = -ball.vy;"
webOnBoard 0:256cd901cbb1 389 "}"
webOnBoard 0:256cd901cbb1 390 "if (ball.x + ball.vx > canvas.width || ball.x + ball.vx < 0) {"
webOnBoard 0:256cd901cbb1 391 " ball.vx = -ball.vx;"
webOnBoard 0:256cd901cbb1 392 "}"
webOnBoard 0:256cd901cbb1 393 " raf = window.requestAnimationFrame(draw);"
webOnBoard 0:256cd901cbb1 394 "}"
webOnBoard 0:256cd901cbb1 395 " raf = window.requestAnimationFrame(draw);"
webOnBoard 0:256cd901cbb1 396 "}"
webOnBoard 0:256cd901cbb1 397 "</script>"
webOnBoard 0:256cd901cbb1 398 "<style type=\"text/css\">"
webOnBoard 0:256cd901cbb1 399 ".style1 {"
webOnBoard 0:256cd901cbb1 400 " text-align: center;"
webOnBoard 0:256cd901cbb1 401 "}"
webOnBoard 0:256cd901cbb1 402 ".style2 {"
webOnBoard 0:256cd901cbb1 403 " text-align: center;"
webOnBoard 0:256cd901cbb1 404 " font-size: large;"
webOnBoard 0:256cd901cbb1 405 "}"
webOnBoard 0:256cd901cbb1 406 "</style>"
webOnBoard 0:256cd901cbb1 407 "</head>"
webOnBoard 0:256cd901cbb1 408 "<body onLoad=\"updatePage();Load_state()\">"
webOnBoard 0:256cd901cbb1 409 "<p class=\"style2\"><strong>WELCOME TO GR-PEACH WEBSERVER</strong></p>"
webOnBoard 0:256cd901cbb1 410 "<table width=\"330\" border=\"0\" align=\"center\">"
webOnBoard 0:256cd901cbb1 411 " <tr>"
webOnBoard 0:256cd901cbb1 412 " <td width=\"90\" class=\"style1\"><input id=\"onoffred\" value=\"ON\" onClick=\"LedRedChange()\" type=\"button\"></td>"
webOnBoard 0:256cd901cbb1 413 " <td width=\"150\" class=\"style1\">LED RED</td>"
webOnBoard 0:256cd901cbb1 414 " <td width=\"70\" class=\"style1\"><canvas id=\"redled\" height=\"40\" width=\"40\"></canvas><script>drawLedOff('redled');</script></td>"
webOnBoard 0:256cd901cbb1 415 " </tr>"
webOnBoard 0:256cd901cbb1 416 " <tr>"
webOnBoard 0:256cd901cbb1 417 " <td width=\"90\" class=\"style1\"><input id=\"onoffgreen\" value=\"ON\" onClick=\"LedGreenChange()\" type=\"button\"></td>"
webOnBoard 0:256cd901cbb1 418 " <td class=\"style1\">LED GREEN</td>"
webOnBoard 0:256cd901cbb1 419 " <td class=\"style1\"><canvas id=\"greenled\" height=\"40\" width=\"40\"></canvas><script>drawLedOff('greenled');</script></td>"
webOnBoard 0:256cd901cbb1 420 " </tr>"
webOnBoard 0:256cd901cbb1 421 " <tr>"
webOnBoard 0:256cd901cbb1 422 " <td width=\"90\" class=\"style1\"><input id=\"onoffblue\" value=\"ON\" onClick=\"LedBlueChange()\" type=\"button\"></td>"
webOnBoard 0:256cd901cbb1 423 " <td class=\"style1\">LED BLUE</td>"
webOnBoard 0:256cd901cbb1 424 " <td class=\"style1\"><canvas id=\"blueled\" height=\"40\" width=\"40\"></canvas><script>drawLedOff('blueled');</script></td>"
webOnBoard 0:256cd901cbb1 425 "</td>"
webOnBoard 0:256cd901cbb1 426 " </tr>"
webOnBoard 0:256cd901cbb1 427 "</table>"
webOnBoard 0:256cd901cbb1 428 "<p class=\"style1\">&nbsp;</p>"
webOnBoard 0:256cd901cbb1 429 "<table width=\"400\" border=\"1\" align=\"center\">"
webOnBoard 0:256cd901cbb1 430 " <tr>"
webOnBoard 0:256cd901cbb1 431 " <td width=\"360\" class=\"style1\" align=\"center\"><canvas id=\"ball\" width=\"400\" height=\"360\"></canvas><script>drawBall();</script></td>"
webOnBoard 0:256cd901cbb1 432 " </tr>"
webOnBoard 0:256cd901cbb1 433 "</table>"
webOnBoard 0:256cd901cbb1 434 "</body>"
webOnBoard 0:256cd901cbb1 435 "</html>"
webOnBoard 0:256cd901cbb1 436 };
webOnBoard 0:256cd901cbb1 437
webOnBoard 0:256cd901cbb1 438
webOnBoard 0:256cd901cbb1 439
webOnBoard 0:256cd901cbb1 440 #ifdef __cplusplus
webOnBoard 0:256cd901cbb1 441 }
webOnBoard 0:256cd901cbb1 442 #endif
webOnBoard 0:256cd901cbb1 443
webOnBoard 0:256cd901cbb1 444 //----------------------------------------------------------------------------
webOnBoard 0:256cd901cbb1 445 #endif //WEBPAGE_H