6 Aralık 2012 Perşembe

Arduino controlled automated blinds with Web UI


Intro

Arduino controlled automated blinds with Web UI

This instructable is a detailed guide on how to build an automated controller to run a motor that can operate the opening and closing of blinds. The controller enables the blinds to open and close based on a schedule, room temperature and out door luminosity. The controller settings can be set up via a web UI which enables a user to open or close the blinds manually or place them on a schedule with certain parameters.

This project will guide you through creating simple circuits for the sensors, hacking the motor shield so it can be stacked with the arduino and ethernet shield and implementation of the code (note all code is provided and is fully commented). The project is laid out in the following manner. First the controller and system will be constructed. Then the logic behind the code will be explained. The last page will contain the code and link to download so it can be installed on the arduino.

So I hope you enjoy this instructable, gain from it and most importantly have fun.

Table of contents:

1.Requirements and parts
2.Wiring the sensors.
3.Wiring the arduino and shields.
4.Hacking the motor shield.
5.Code logic.


Step 1: Requirements and parts

This project is fairly simple to create and set up since the most difficult part, the code, is fully provided. The setting up the arduino and shields is fairly straight forward. Below is a list of parts you will need for this project. I have also listed the prices for these parts if you need do not have them. Most of these can be ordered from Adafruit, Sparkfun or the robotshop.

1. Arduino ($30)
2. Ethernet shield ($50)
3. Motor Shield ($20)
4. Analog temperature (TMP36)  sensor ($2)
5. Photocell ($1)
6. 20 pin 0.1" Female Headers ($3)
7. Breadboarding Wire Bundle (6)
8. Breadboard friendly 2.1mm DC Jack ($1)
9. 12 V Stepper Motor (14)
10. 100 ohm resistor
11. MicroSD card (1gb card is good and can be found for as little as $2).
12. 2 Full breadboards ($14)
13. 12V AC adapter. (powers the motor only)
14. battery pack for the arduino

Remember, all these parts can be used for other projects, so don't worry too much about the cost because you'll be able to use them in many more projects, unless of course you are gonna use this as a permanent installment.

Equipment needed
1.Soldering iron
2.Soldering Fan
3. Small screwdriver.

Step 2

Wiring the sensors

Step 1: .

Combine the aruino with the ethernet shield.

Step 3

Stepper Motor and Motor Shield

Connect the 12 V Stepper motor to the motor shield in the M3 and M4 slots.  Instructions on how to solder the motor shield can be found here: http://www.ladyada.net/make/mshield/make.html

Step 4

DC Jack

If you have the breadboard friendly 2.1mm DC jack, plug it into the breadboard. Place it near the edge of the board., Later all of the ground ports will be placed in series with the ones from the DC Jack. In the image above, three wires were soldered to the DC jack to extend it length.

Step 5

Temperature sensor

Place the analog temperature sensor in the breadboard as shown above. The first pin is power, the second is output and the third is ground. Wire the ground to the in series with  the ground pins for the DC jack.

Step 6

Photocell

Place the photocell on the breadboard and connect a resistor to it as shown above. The pins are in the same order as on the temperature sensor. Again connect the ground to the ports we are using for all the ground connections.

Step 7

Hack

Now place the motor shield in the second breadboard with the motor facing away from the arduino (as in the image above; notice that the motor is not in the picture).

Now for a hardware hack. The arduino communicates to the ethernet shield and motor shield on several different pins but pin 12 is common to both and this causes conflict. To fix this, we are gonna do a software hack so that data the arduino usually sends through pin 12 goes through pin 9 instead. First wire output pin 9 on the ethernet shield to the input slot that matches with 12 on the motorshield.

Now go find motors.h on your computer (usually in the arduino file under mydocuments/arduino/libraries) and open it up. Find the line #define MOTORLATCH 12 and change that to a 9. Save this file.

And there we go.

Step 8

Wiring outputs to inputs

Now finish wiring the rest of the output pins on the ethernet shield to there corresponding pin on the motor shield (except for pin 9 and 12).

Step 9

Second breadboard

Connect the motor shield to the breadboard as shown in the image.

Step 10

More wiring

Connect the out put pins for 3V, 5V Gnd, 0 and 1 in series to thier corresponding ports on the breadboard for pins on the motor shield. For example, in the image above, the orange wire goes from 3 V on the enternet shield to 3 V on the motor shield.

Step 11

Giving the motor shield power

Connect a wire (teal in the image above) in series with the power output from the DC jack and wire this to the port on the breadboard that is in series with the VIN port on the motor shield.

Step 12

Grounding

Now connect all the ground wires that are in series to the ground port on the ethernet shield. Observe the held blue wire in the image. Just as a mention, don't  forget to place a micro SD card in your ethernet shield. 

Step 13

All Done

No finish by taking the power wire for the temperature sensor and connecting it to 3 V on the motor shield. Do the same for the photocell but connect to 5 V (remember that first wire is power). The second wire goes to the input on the motor shield. Place the temp sensor on 0 and photcell on 1.

AND YOU ARE DONE CONSTRUCTING THE DEVICE.

Step 14: The code

A detailed explanation for the code will be coming soon. For now you can download the code below and run it. I have commented throughout to make modification easy.

Important:
1. you will need to manually enter the IP address of your device and its MAC address into the code before running. You can get the IP address after connecting the ethernet shield to a router and loading the DHCPaddress program found under exmaples in the arduino sketch program.
Go through the code and enter your IP address anywhere it says or you notice an IP. There is only 3.

DOWNLOAD HERE: http://www.2shared.com/file/guPvu-HK/WindowBlindsSever1_4.html

Step 15

Final output

Once the sketch is loaded, you will be able to access the web UI via the IP address. It should appear as the images above.

The program works the following way:

-Via the web UI you can maunually open and close the blinds.
-You can also set a automatic timer that will open and close the blinds based on the following conditions.
         If temperature exceeds the temp entered by user, the blinds close, else open.
         If brightness is below luminosity entered by user, blinds close, else open.
         else it will open and close at the times specified.

Step 16: Running your blinds

The motor shaft can be connected in various ways to blinds to operate them. Easiest way to implement this is to use IKEA rollar blinds and attack the motor to the main shaft of the blinds. The design I have shown you here is just to give an idea of the set up of how such a system would work. Modifications are needed on your part to make it fit into the set up you have.

pepperm says:Nov 8, 2012. 1:33 AM
Thanks for the code but it is too big to fit into the ATMega328 Arduinos as featured in the Instructable. It will fit into the 1280 2560 based Arduino's because they have much more memory. I have even removed the Temperature sensing bits of code which involve floating point maths and the code still doesnt fit into the smaller Arduinos. So how did the author get it to work?
FreedomToCreate (author) says:Nov 28, 2012. 2:12 PM
Hey, The code works out to about 32kb which fits perfectly onto an arduino uno R3 used in the instructable. The ATMega 328 have 32Kb of which 0.5 is used by the bootloader. What size is your compiler saying the code is?
pepperm says:Dec 2, 2012. 7:00 AM
Interesting because I dont believe that it says that an Uno is used, in the article. It just says Arduino and the actual Arduino is hidden under the Ethernet shield. When I compile for an Uno I get a sketch size of 32,188 bytes which fits, but when compiling for a Duemilanove w/Atmega328 the size is the same but the space available is 30,720 bytes so the project doesnt fit. I dont understand what the difference is. Anyone any clues please? Isn't the microntroller the same one? I actually have a Freeduino 328.
dubstepmaker says:Nov 28, 2012. 11:16 PM
very nice, i could definitely use these most mornings.
draythomp says:Nov 18, 2012. 9:57 AM
Very nice job, and food for thought in the future. However, how the heck would one hook the servo to window blinds? Just wrapping the cord around the motor spindle won't do the job for very long. Using two power supplies makes it simple, but how many people have two outlets below the blind to plug in wall warts? One would have to use wall power since the servo would discharge a battery in a short time. I have to think of the aesthetics of a couple of wall warts plugged in below a window with the wires routing up the wall to a big ol' servo nailed somehow and attached to the cord or twist projection on the blind; especially since most wall warts are black.
FreedomToCreate (author) says:Nov 28, 2012. 2:09 PM
Hey. If you connect the motor to a IKEA rollar blinds (come in various sizes and range from 10 to 20 dollars), the motors produces enough torque to rotate the shaft to open and close the blinds. As soon as I get time, I will upload a instructable on how to connect the motor to the blinds, but for now, experiment. As for the power required. A standard 9V power supply connected to the motor should last for a couple of weeks. I am working on a more efficient circuit design(the one given is extremely basic). Overall the conclusion is that this instructable is mostly an opportunity to experiment.
Build_it_Bob says:Nov 12, 2012. 8:03 PM
Very nice , I am looking forward to reading through your code . Thank you for share !
Build_it_Bob
pepperm says:Oct 15, 2012. 12:55 AM
How do you download the code from that god awfull download site?
pepperm says:Oct 17, 2012. 1:58 AM
All roads lead to an iLivid download or a bet 365 advertisement (for me) and nothing to the WindowBlindsSever1_4 code. The project looks really interesting but is worthless without the code to play with, so how do we get the code please?
ikohler says:Sep 30, 2012. 2:19 AM
What version of IDE did you use? I tried to use your code, but I'm getting some error during upload, when using 1.0 or 1.0.1 with Arduino Uno smd R2. Cheers
FreedomToCreate (author) says:Sep 30, 2012. 7:56 AM
I have 1.0.1. What is the error that you are getting? 
ikohler says:Sep 30, 2012. 12:00 PM
All I get is the below:

Binary sketch size: 32,184 bytes (of a 32,256 byte maximum)
avrdude: stk500_recv(): programmer is not responding

The sketch compiles just fine when I verify it, but it fails during upload part. When I tried with 1.0 it was complaining about the size of the sketch, so I'm wondering if it has anything to do with that as it is very close to the limit.

Anybody else experiencing the same?
FreedomToCreate (author) says:Sep 30, 2012. 12:23 PM
The issue is not with the sketch. Check to make sure that you have the IDE set for the right type of arduino board and port. You could also try a different USB port on your computer.
ikohler says:Sep 30, 2012. 11:33 PM
I know the sketch is good as it does compile fine. I have narrowed it down to arduino UNO smd R2. I tried my arduino mega and that works fine. Thanks for help.
jjester1 says:Sep 28, 2012. 10:30 AM
Why not post a picture of blinds opening/closing in action?
FreedomToCreate (author) says:Sep 29, 2012. 10:04 AM
I have been adding modifications to the set up I have and will post a video once that is complete. 
pdemetrios says:Sep 29, 2012. 9:24 AM
Very good job. Well written code.Thanks.
amandaghassaei says:Sep 27, 2012. 12:09 PM
do you have a video of the final project? would be great to see that in your intro step!
FreedomToCreate (author) says:Sep 27, 2012. 4:26 PM
I will get a video up. I am thinking of modifying it so it can be implemented far more easily after which I can show the motor operating the blinds.
useraaaaa says:Sep 27, 2012. 12:24 PM
13. 12V AC to DC adapter.
14. battery pack for the arduino


LOL
FreedomToCreate (author) says:Sep 27, 2012. 1:58 PM
The 12 V AC adapter is for powering the motor only. The arduino uses a seperate 9V.







/*
Automated Blinds Controller
Programmed by Sarbjeet Singh
Last revision: August 30, 2012
*/

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

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x0D, 0xE0 };
IPAddress ip(192,168,0,10); //<<< ENTER YOUR IP ADDRESS HERE!!!

// Initialize the Ethernet server library
// with the IP address and port you want to use 
// (port 80 is default for HTTP):
EthernetServer server(80);

byte mem0=0; 
byte mem1=0; //variables to set transition state
byte TemPin=0;  //Input Pin for Temperature sensor
byte photocellPin=1; //Input Pin for Photocell
byte stepperRevolution=200; //number of steps taking for stepper to make on revolution. 
byte limitRev=5;//number of revolutions needed to open or close blind. 
byte NumberOfRevsFor=0; //Counter for number of revolutions completed by stepper motor going forward.
byte NumberOfRevsBack=limitRev; //Counter for number of revolutions completed by stepper motor in reverse.
AF_Stepper motor(200,2); //200 step/rev motor connect to M3 and M4 on motor shield 
File myFile; 
String value;
byte SDreadAtStart=0;
byte openHour,closeHour,ctltemp, OvRCtl=0, timeHour, timeMin; 
int Luminosity; //variable which sensor luminosity reading is compared against. 

void setup()
{  
   Serial.begin(9600); 
   pinMode(10, OUTPUT); //set up reading and writing to SD card
   SD.begin(4);    
   motor.setSpeed(250); //set motor 200 rpm.
   // start the Ethernet connection and the server:
   Ethernet.begin(mac, ip);    
   server.begin();  
   //SDreader("BlindCtl/Settings/Settings.txt"); //read values in from Time file. Hour and minute values are saved temporarily saved to Luminosity and ctltemp
   //setTime(timeHour,timeMin,0,10,7,2012); //set current time on arduino   
   delay(1000); //Give ethernet and sensors time to set up.   
}



void loop()//main 
{    
  byte SDread;   
  SDread=EthernetClients();   //checks to see if client is connected  
        
  if(SDreadAtStart==0||SDread==1)
  {            
      SDreader("BlindCtl/Settings/Settings.txt");   //reads values from Settings.txt
      setTime(timeHour,timeMin,0,10,7,2012);  
      SDreadAtStart=1;     
  }      
  //Serial.println(Luminosity);           
  motors(Luminosity,ctltemp,openHour,closeHour);    
}

void motors(int luminosity, byte ctltemp, byte openHour, byte closeHour)//(byte Open, byte Close)
{
 // Serial.println(F("motors is started"));
  time_t t=now();//set current time to variable t
  byte curTime=hour(t); //saves the current hour
  Serial.println(curTime); 
  //String readFile, value; 
  analogRead(TemPin);
  delay(10);
  int temRead=analogRead(TemPin); //reads in from temperature sensor
  float temVoltage=temRead*5.0;
  temVoltage/=1024.0;   
  float temperature=(temVoltage-0.5)*100;
  delay(10); //delay to let voltage settle before reading from photocell
  
  analogRead(photocellPin);
  delay(10);
  int photocellReading=analogRead(photocellPin);//reads the photocell value
  delay(10);
  if(OvRCtl==1)//checks for variable that indicates if blinds should auto open and then sets requirements to low. 
  {
    luminosity=200; 
    ctltemp=temperature+5;
    openHour=0;
    closeHour=24; 
  }
  else if(OvRCtl==2)//checks variable to see if override for close is enables and then sets requirements high. 
  {
    luminosity=999; 
    ctltemp=25;
    openHour=0;
    closeHour=24;    
  }
  else
  {
    if(luminosity<=200||luminosity>=1000)//error checks to make sure user has not entered values outside of scope.
      luminosity=600; 
    if(ctltemp<=5||ctltemp>=60)
      ctltemp=25; 
    if(openHour<=(-1)||openHour>=25)
      openHour=13;
   if(closeHour<=(-1)||closeHour>=25)
      closeHour=20;
  } 
  
  if(mem0==0&&mem1==0)//State one where blinds are closed
  { 
   // Serial.print("Blinds are closed \n");
   if((photocellReading>=luminosity)&&(curTime>=openHour)&&(curTime<closeHour)&&(temperature<=ctltemp))//If all three of these conidtions are met, blinds will move into opening state. 
    { 
      mem0=1;
    }
  }
  
  else if(mem0==1&&mem1==0)//Moving forward state
  { 
    //Serial.print("Blinds are opening \n");    
    if(NumberOfRevsFor==limitRev)//checks to see if blinds are fully open and if so, switches to fully open state.  
    {          
     mem1=1;
     mem0=1; 
    }     
    else if((photocellReading>=luminosity)&&(curTime>=openHour)&&(curTime<closeHour)&&(temperature<=ctltemp))//&&(NumberOfRevsFor!=TravelForward))//confirms that opening condition is still present and continues to move motor forward
    {
      motor.step(stepperRevolution, FORWARD, DOUBLE); 
      motor.release();
      NumberOfRevsFor++;      
      NumberOfRevsBack--;
          
    } 
    else if(temperature>ctltemp||curTime>=closeHour||photocellReading<luminosity)//switches state to move back in closing condition has become true
    {      
      mem1=1;
      mem0=0; 
    }     
      
  }
  
  else if(mem0==1&&mem1==1)//Full Open position
  {
   // Serial.print("Blinds are open \n");
    if(temperature>ctltemp||curTime>=closeHour||photocellReading<luminosity)//condition to move into closing state
    {
      mem1=1;
      mem0=0; 
    }    
  }
  
  else if(mem0==0&&mem1==1)//Blinds closing state
  {  
   //Serial.print("Blinds are closing \n"); 
        
    if(NumberOfRevsBack==limitRev)//switches to closed state if blinds are fully closed. 
    {
     mem1=0;
     mem0=0; 
    }     
    else if((temperature>ctltemp||curTime>=closeHour||photocellReading<luminosity))//&&NumberOfRevsBack!=TravelBack)//checks for closing conditions and then proceeds to close blinds. 
    {
      motor.step(stepperRevolution, BACKWARD, DOUBLE);
     motor.release(); 
      NumberOfRevsBack++;
      NumberOfRevsFor--;
        
    } 
    else if(photocellReading>=luminosity&&curTime>=openHour&&curTime<closeHour&&temperature<=ctltemp)//if conditions for blinds opening become true, switches to blind open state
    {       
      mem1=0;
      mem0=1; 
    }
  }
  Serial.print(mem0);
  Serial.print(mem1);
  return; 
}

byte EthernetClients()//web clients that takes what the user sets and saves them to teh SD card
{
  boolean stopreading=0,variablePresent=0,storevalue=0,timeOn=0,clientC=0, equalsCount=0, SDread=0;
  String readURL;
  delay(10); 
  EthernetClient client = server.available(); 
  //Serial.println("Eth");  
  if (client) 
  {    
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    //Serial.println("Client available"); 
    Serial.println(F("Client")); 
    
    while (client.connected()) {
      if (client.available()) {
       
        char c = client.read();
        if(c=='?')
        {
          variablePresent=1;        
        }        
                
        if (c=='z'){//stops reading into the string once end of header is reached. 
          stopreading=1;}
        else if(c!='z' && stopreading==0&&variablePresent==1)//reads in GET from the HTTP header
        {
          readURL+=c;
        //Serial.println(readURL);        
        }
        
        //delay(1000);
     if(stopreading==1&&variablePresent==1&&storevalue==0)//reads stored GET header to extract variables
     { 
       
      for(int i=0; i<=(readURL.length()-1); i++)
      {        
        if(readURL[i]=='=')
        {
          int j=i+1;
          while(readURL[j]!='&'&&readURL[j]!='x')
          {
             value+=readURL[j];
             j++;
          }           
         
         if(value=="Open")
           OvRCtl=1;  
         if(value=="Close")
           OvRCtl=2;  
         
         if(equalsCount==0&&value=="Time"){
            timeOn=1;
            OvRCtl=0;}
         else if(value!="Open"&&value!="Close"&&equalsCount==0){
          //timeOn=0; 
           SD.remove("BlindCtl/Settings/Settings.txt");
           myFile= SD.open("BlindCtl/Settings/Settings.txt",FILE_WRITE);          
           myFile.print(F("Luminx"));
           myFile.print(value); 
           myFile.print("z");
           myFile.close();   
          }
         if(equalsCount==1)
        {    
          myFile= SD.open("BlindCtl/Settings/Settings.txt",FILE_WRITE);      
          myFile.print(F("Tempx"));
          myFile.print(value); 
          myFile.print("z");
          myFile.close(); 
        }  
         if(equalsCount==2)
        {   
           myFile= SD.open("BlindCtl/Settings/Settings.txt",FILE_WRITE);        
          myFile.print(F("OpenHourx"));
          myFile.print(value); 
          myFile.print("z"); 
          myFile.close(); 
        }
        if(equalsCount==3)
        {         
          myFile= SD.open("BlindCtl/Settings/Settings.txt",FILE_WRITE);  
          myFile.print(F("CloseHourx"));
          myFile.print(value); 
          myFile.print("z"); 
          myFile.close();
        } 
        if(equalsCount==4)
        {         
          myFile= SD.open("BlindCtl/Settings/Settings.txt",FILE_WRITE);  
          myFile.print(F("Hourx"));
          myFile.print(value); 
          myFile.print("z"); 
          myFile.close();
        }
        if(equalsCount==5)
        {         
          myFile= SD.open("BlindCtl/Settings/Settings.txt",FILE_WRITE);  
          myFile.print(F("Minx"));
          myFile.print(value); 
          myFile.print("z"); 
          myFile.close();
        }
             
         equalsCount++;
          value="";                  
       }
      }
      storevalue=1; 
     }     
        // if you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so you can send a reply
     if (c == '\n' && currentLineIsBlank) 
     {          
          // send a standard http response header
       client.println(F("HTTP/1.1 200 OK"));
       client.println(F("Content-Type: text/html"));
       client.println();         
       //Any variables cannot contain the characters of z or x! Last variable values must end with xz.
       client.println(F("<div align='center'"));
       client.println(F("<h1>Windows Blinds Client V 1.0</h1>"));
       client.println(F("</div>"));
       // client.println("<div align='center'");
       if(timeOn==0)  
       {         
          client.println(F("<form name='input' action='192.168.0.10' method='get'>"));
          client.println(F("<input type='radio' name='action' value='Openxz' /> Open"));
          client.println(F("<input type='radio' name='action' value='Closexz' /> Close"));
          client.println(F("<input type='radio' name='action' value='Timexz' /> Time"));           
          client.println(F("</br>"));
          client.println(F("<input type='submit' value='Submit'/>"));
          client.println(F("</form>"));
       }
       else if(timeOn==1)
       {
          client.println(F("<form name='input' action='192.168.0.10' method='get'>"));            
          client.println(F("Luminosity:<input type='text' name='Hour' value='600'/>"));
          client.println(F("Temp(close):<input type='text' name='Minutes' value='26'/>"));
          client.println(F("</br>"));            
          client.println(F("Open Blinds At*(hour):<input type='text' name='openTime'/>"));
          client.println(F("Close Blinds At(hour):<input type='text' name='closeTime'/>"));
          client.println(F("</br>"));
          client.println(F("Current Hour:<input type='text' name='Hour'/>"));
          client.println(F("Current Min:<input type='text' name='Min'/>"));
          client.println(F("<input type=hidden name='action' value='xz' />"));
          client.println(F("<input type='submit' value='Submit'/>"));            
          client.println(F("</form>"));
          client.println(F("</br>"));                         
        }                     
          

      break;
      }
      if (c == '\n') {
          // you're starting a new line
         currentLineIsBlank = true;
      } 
      else if (c != '\r') {
          // you've gotten a character on the current line
          currentLineIsBlank = false;
      }
    }
      
      
    // if (loopcounter<=readURL.length())
    //loopcounter++;     
    }
    // give the web browser time to receive the data
    delay(1);
    // close the connection:
    client.stop();
    SDread=1; 
    //Serial.print('Broswer is closed'); 
  }
  return SDread; 
}

void SDreader(const char* fileName)//function to read the values from teh SD card into variables
{
  byte equalsCount=0;
  String readURL; 
 //Serial.println('SD'); 
  myFile= SD.open(fileName);      

       while(myFile.available())//reads the entire file in a String
      { 
        char c=myFile.read(); 
        readURL+=c; 
      }
      myFile.close();
      //Serial.println(readURL);
      for(int i=0; i<=(readURL.length()); i++)//extracts values from file that are between x and z
      {
        
      if(readURL[i]=='x')
       {         
         int j=i+1;
         i=j; 
         while(readURL[j]!='z')
         {
           value+=readURL[j];
           j++;
         }            
       //Serial.println(value);
       if(equalsCount==0)
          {
            char string_as_char[value.length()+1];
            value.toCharArray(string_as_char,value.length()+1);         
            Luminosity=atoi(string_as_char);
            //Serial.println(Luminosity);            
          }
          if(equalsCount==1)
          {
            char string_as_char[value.length()+1];
            value.toCharArray(string_as_char,value.length()+1);         
            ctltemp=atoi(string_as_char);
            //Serial.println(Luminosity);            
          }
           if(equalsCount==2)
          {
            char string_as_char[value.length()+1];
            value.toCharArray(string_as_char,value.length()+1);         
            openHour=atoi(string_as_char);
            //Serial.println(Luminosity);            
          }
          
          if(equalsCount==3)
          {
            char string_as_char[value.length()+1];
            value.toCharArray(string_as_char,value.length()+1);         
            closeHour=atoi(string_as_char);             
          }
          
          if(equalsCount==4)
          {
            char string_as_char[value.length()+1];
            value.toCharArray(string_as_char,value.length()+1);         
            timeHour=atoi(string_as_char);             
          }
          if(equalsCount==5){
            char string_as_char[value.length()+1];
            value.toCharArray(string_as_char,value.length()+1);         
            timeMin=atoi(string_as_char);          
          }          
             
         equalsCount++;
          value="";                  
       }
      }
      //Serial.print(Luminosity);
      return; 
}

Hiç yorum yok: