Sending commands from a website stored in a microSD card.

Hi, I am a beginner with the Arduino and I am using it to make a pill dispenser. The mechanical part itself of moving the motor when a IR sensor detects it works fine. I also have managed to create a website with a button that when pressed, it causes the motor to move as well.

My problem has to do with this more advanced website I have created using notepad c++ which you can access at: itcup.skuttcatholic.com

What I am trying to do is so when the alarm goes off, the motor in the arduino moves. However I dont know how to send commands from the website in the microSD which is the one you saw^^. So my question how to communicate between a microSD website written in notepad to the arduino to spin a motor. I ll upload the code if needed. Thanks for any help!

However I dont know how to send commands from the website in the microSD which is the one you saw

You can't send commands from an SD card. You can send data. Presumably, the data that you want to send is the web page to display, which apparently works.

Post ALL of your code, so we can do a better job of guessing what it is you want to do.

Here first is the code from the website you can see on the link itcup.skuttcatholic.com

Skutt Catholic » Pill-O-Matic body { background-attachment: fixed; background-color: #D9EEFF; background-repeat: repeat; font-family: 'Open Sans', sans-serif; font-size: 11px; line-height: 15px; } a { color: #000000; text-transform: none; } a:link, a:active, a:focus, a:visited { color: #000000; text-transform: none; } a:hover { color: #DDDDDD; text-transform: none; } #center { margin: 0; position: absolute; width: 100%; left: 0px; top: 2px; } #center img { position: absolute; z-index: -3; } #center #content { position: absolute; width: 90%; } #center #content .button { float: right; font-size: 12px; margin: 25px 0; position: relative; z-index: 999; } #center #content .button a { background-color: #006ECE; border-radius: 20px; color: #FFFFFF; display: block; font-family: 'Open Sans', sans-serif; font-weight: normal; padding: 12px; text-decoration: none; text-transform: uppercase; -webkit-transition: background-color ease-out 0.5s; -moz-transition: background-color ease-out 0.5s; -o-transition: background-color ease-out 0.5s; transition: background-color ease-out 0.5s; z-index: 999; } #center #content .button a:hover { background-color: #6DB9FC; -webkit-transition: background-color ease-out 0.5s; -moz-transition: background-color ease-out 0.5s; -o-transition: background-color ease-out 0.5s; transition: background-color ease-out 0.5s; z-index: 999; } #center #holder { float: right; width: 90%; } #center #holder .title { color: #006ECE; float: left; font-family: 'Comfortaa', sans-serif; font-size: 35px; font-weight: 300; margin: 35px auto; position: relative; z-index: 99999; } #center #holder .title a { color: #006ECE; text-decoration: none; } #center #holder .title a:hover { color: #006ECE; } #center #container { color: #6A6A6A; font-family: 'Helvetica Neue', 'Open Sans', sans-serif; position: relative; text-align: center; width: 100%; } #center #container h1 { font-size: 75px; font-weight: 100; margin: 175px 0 25px; } #center #container h2 { font-family: 'Helvetica Neue', 'Open Sans', sans-serif; font-size: 35px; font-weight: 100; line-height: 40px; padding-left: 15%; padding-right: 15%; position: attached; } #center #container h3 { font-family: 'Open Sans', sans-serif; font-size: 20px; font-weight: 100; line-height: 35px; margin: 50px 0; padding-left: 15%; padding-right: 15%; position: attached; } #center #container img { margin: 20px 0; max-height: 50%; max-width: 75%; padding-bottom: 125px; padding-left: 15%; padding-right: 15%; position: relative; } #center #container_opposite { color: #FFFFFF; font-family: 'Helvetica Neue', 'Open Sans', sans-serif; position: relative; text-align: center; width: 100%; } #center #container_opposite h1 { font-size: 75px; font-weight: 100; margin: 175px 0 25px; } #center #container_opposite h3 { font-family: 'Open Sans', sans-serif; font-size: 20px; font-weight: 100; line-height: 35px; margin: 50px 0; padding-left: 15%; padding-right: 15%; position: attached; } #center #container_opposite img { margin: 20px 0 -2px; max-width: 45%; padding-left: 15%; padding-right: 15%; position: relative; } #color_box_white { background-color: #FFF; display: block; padding: 2px; position: relative; width: 100%; z-index: 1; } #color_box_gray { background-color: #424242; display: block; padding: 2px; position: relative; width: 100%; z-index: 1; }

/*** HEADER STYLES ***/
#header {
background: rgba( 255, 255, 255, 0.7 );
display: block;
height: 100px;
margin: -10px 0;
position: fixed;
width: 100%;
z-index: 99;
}
#footer {
background-color: #000000;
display: block;
padding: 35px 0;
position: relative;
width: 100%;
z-index: 1;
}
#footer #body {
color: #FFFFFF;
font-family: ‘Open Sans’, sans-serif;
font-size: 12px;
margin-top: 20px;
position: relative;
text-transform: uppercase;
width: 100%;
z-index: 999;
}
#footer #body ul {
display: inline;
list-style-type: none;
}
#footer #body ul li {
padding-left: 50px;
padding-top: 5px;
}

#footer #body_2 {
color: #FFFFFF;
font-family: ‘Open Sans’, sans-serif;
font-size: 12px;
margin-top: -115px;
position: absolute;
text-transform: uppercase;
width: 100%;
z-index: 999;
}
#footer #body_2 ul {
display: inline;
list-style-type: none;
}
#footer #body_2 ul li {
padding-left: 250px;
padding-top: 5px;
}

/*** ALARM CLOCK ***/
#clock {
font-size: 11px;
font-weight: normal;
}
#clock span{
margin-right: 5px;
}
#clock h2 {
font-family: ‘Helvetica Neue’, sans-serif;
font-size: 30px;
font-weight: 100;
line-height: 40px;
margin: -20px 0;
}
#clock h3 {
font-family: ‘Helvetica Neue’, sans-serif;
font-size: 50px;
font-weight: 100;
line-height: 35px;
margin: 7px 0 40px;
}

/** POP-OUT LINKS **/
#fade {
background: #000000;
display: none;
height: 100%;
position: fixed;
left: 0;
top: 0;
width: 100%;
opacity: 0.7;
z-index: 9999;
}
.popup_block {
border-radius: 10px;
color: #6A6A6A;
display: none;
background: #FFFFFF;
float: left;
font-size: 12px;
left: 51%;
margin-left: 25%;
margin-right: 25%;
padding: 50px 20px 20px 20px;
position: fixed;
top: 50%;
webkit-transition: all 0.8s ease;
-moz-transition: all 0.8s ease;
transition: all 0.8s ease;
z-index: 99999;
}
.popup_block a {
color: #999999;
}
.close {
float: right;
margin: -40px -5px 0 0;
text-decoration: none;
webkit-transition: all 0.8s ease;
-moz-transition: all 0.8s ease;
transition: all 0.8s ease;
}

var jsalarm={ padfield:function(f){ return (f<10)? "0"+f : f }, showcurrenttime:function(){ var dateobj=new Date() var ct=this.padfield(dateobj.getHours())+":"+this.padfield(dateobj.getMinutes())+":"+this.padfield(dateobj.getSeconds()) this.ctref.innerHTML=ct this.ctref.setAttribute("title", ct) if (typeof this.hourwake!="undefined"){ //if alarm is set if (this.ctref.title==(this.hourwake+":"+this.minutewake+":"+this.secondwake)){ clearInterval(jsalarm.timer) countdowntimer() } } }, init:function(){ var dateobj=new Date() this.ctref=document.getElementById("jsalarm_ct") this.submitref=document.getElementById("submitbutton") this.submitref.onclick=function(){ jsalarm.setalarm() this.value="Alarm Set" this.disabled=true return false } this.resetref=document.getElementById("resetbutton") this.resetref.onclick=function(){ jsalarm.submitref.disabled=false jsalarm.hourwake=undefined jsalarm.hourselect.disabled=false jsalarm.minuteselect.disabled=false jsalarm.secondselect.disabled=false return false } var selections=document.getElementsByTagName("select") this.hourselect=selections[0] this.minuteselect=selections[1] this.secondselect=selections[2] for (var i=0; i<60; i++){ if (i<24) //If still within range of hours field: 0-23 this.hourselect*=new Option(this.padfield(i), this.padfield(i), false, dateobj.getHours()==i)* _ this.minuteselect*=new Option(this.padfield(i), this.padfield(i), false, dateobj.getMinutes()==i)*_ _ this.secondselect*=new Option(this.padfield(i), this.padfield(i), false, dateobj.getSeconds()==i)*_ _* }*_ _* jsalarm.showcurrenttime()*_ _* jsalarm.timer=setInterval(function(){jsalarm.showcurrenttime()}, 1000)*_ _* },*_

setalarm:function(){
this.hourwake=this.hourselect.options[this.hourselect.selectedIndex].value
this.minutewake=this.minuteselect.options[this.minuteselect.selectedIndex].value
this.secondwake=this.secondselect.options[this.secondselect.selectedIndex].value
this.hourselect.disabled=true
this.minuteselect.disabled=true
this.secondselect.disabled=true
}
}
function countdowntimer()
{
setInterval(function(){alert(“Your loved one has not taken his/her medication!”)},30000);
}

Welcome.

Skutt Catholic students are introducing a simpler, more cost-effective way to help your loved ones remain independent.

Easy to use.

All your medications. One device. No additional fees.

Easy to monitor.

Mobile website will alert you whether your loved one has taken their medication.

Current Time:

AND HERE IS THE ARDUINO CODE:

#include <SPI.h>
#include <Ethernet.h>
#include <SD.h>

// MAC address from Ethernet shield sticker under board
byte mac = { 0x90, 0xA2, 0xDA, 0x0F, 0x01, 0xE8 };
IPAddress ip(192,168,0,38);// IP address, may need to change depending on network
EthernetServer server(80); // create a server at port 80

File webFile;

void setup()
{
Ethernet.begin(mac, ip); // initialize Ethernet device
server.begin(); // start to listen for clients
Serial.begin(9600); // for debugging
pinMode(9,OUTPUT);

// initialize SD card
Serial.println(“Initializing SD card…”);
if (!SD.begin(4)) {
Serial.println(“ERROR - SD card initialization failed!”);
return; // init failed
}
Serial.println(“SUCCESS - SD card initialized.”);
// check for index.htm file
if (!SD.exists(“index.htm”)) {
Serial.println(“ERROR - Can’t find index.htm file!”);
return; // can’t find index file
}
Serial.println(“SUCCESS - Found index.htm file.”);
}

void loop()
{
EthernetClient client = server.available(); // try to get client

if (client) { // got client?
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) { // client data available to read
char c = client.read(); // read 1 byte (character) from client
// last line of client request is blank and ends with \n
// respond to client only after last line received
if (c == ‘\n’ && currentLineIsBlank) {
// send a standard http response header
client.println(“HTTP/1.1 200 OK”);
client.println(“Content-Type: text/html”);
client.println(“Connection: close”);
client.println();
// send web page
webFile = SD.open(“index.htm”); // open web page file
if (webFile) {
while(webFile.available()) {
client.write(webFile.read()); // send web page to client
}
webFile.close();
}
break;
}
// every line of text received from the client ends with \r\n
if (c == ‘\n’) {
// last character on line of received text
// starting new line with next character read
currentLineIsBlank = true;
}
else if (c != ‘\r’) {
// a text character was received from client
currentLineIsBlank = false;
}
} // end if (client.available())
} // end while (client.connected())
delay(1); // give the web browser time to receive the data
client.stop(); // close the connection
} // end if (client)
}

You didn't read #7 below.

http://forum.arduino.cc/index.php/topic,148850.0.html

There is a method in the file class to read an array of characters from the file. Reading and sending characters in bunches is orders of magnitude faster then sending packets containing one character apiece, as you are doing.

It is not at all clear what help you need. You've posted an incorrectly formatted link to a web site, so that the link doesn't work. You've posted a ridiculously long source dump of the page, requiring is to cut and paste it back together if we cared enough.

That page is unnecessarily complicated, with style shits and java scripting. It's hard to pick out what you are really trying to show the user.

You've incorrectly posted code.

What you haven't done is said what the problem is.

What I am trying to do is so when the alarm goes off

What alarm?

he motor in the arduino moves.

Simple enough. Send a GET request with appropriate data.

However I dont know how to send commands from the website

See above.

I'd use a much less complicated web page, with a form and one or more submit buttons that automatically generate a new GET request.

You can do it however you want, but this doesn't really seem like an Arduino problem. It's more like you don't know how to make your page generate a new GET request. I can't help you with that. It's far to complicated a mess for me to understand.