• Top

    ori feher lingerie
    Orsi Fehér

  • Wilson Blogue - logotipo e cabeçalho




    GMail + arduino – notificador de novos e-mail

    A ideia deste projecto é fazer um paper toy que avisa sempre que temos um nova mensagem na conta do gmail. O código original é escrito em phyton e executado em linux, para o arduino com porta série (rs232). Além disso, é necessário ter blibliotecas específicas instaladas.
    3175602660 d3406db816 GMail + arduino   notificador de novos e mail
    No site oxteto.com está disponível código para windows, escrito em visualbasic. Basta instalar este ficheiros, - MS Visual Basic 6 runtimes – http://support.microsoft.com/kb/290887 - MS Comm Control 6.0 (mscomm32.ocx) - MS Internet Transfer Control 6.0 (msinet.ocx) e executar o PGN2.exe.

    Nota: o código utiliza a porta COM11, por isso torna-se necessário ir ao Gestor de Dispositivos selecionar Portas (COM e LPT), onde diz USB Serial Port, se tiver mais de um, escolher o que tem o fabricante FTDI e mudar para a porta COM.

    Via Paper Toy & Arduino @ Physical Gmail Alert
    Código ligeiramente alterado:


    apenas adicionei 2 led’s – 1 para indicar que o código está a ser executado no arduino, e outro para sinalizar que há comunicação com a porta série/usb


     
    int outPin = 11;        // Output connected to PWM pin 11
     int mail = 0;           // mail count
     int val;                // Value read from the serial port
     int pwm = 0;            // Led PWM control
     int myloop = 0;
     
    int ligado = 12;        //led detecta código no arduino              
    int serie = 10;         // detecta se há comunicação com a porta série/usb

     void setup()
     {
       Serial.begin(9600);
       Serial.flush();

       //código extra
         pinMode(ligado, OUTPUT);   pinMode(serie, OUTPUT);
     }
     
     void loop()
     {
    //      
       digitalWrite(ligado, 255);

       // Read from serial port
       if (Serial.available())
               //
            digitalWrite(serie, 255);
       {
         val = Serial.read();
         Serial.println(val);
         if ((val > 48) && (val < 59)) mail = val-48;
         // 48=0mails 49=1mail 50=2 … 57=9 58=:
       // : is more than 9 mails, so we keep led always on
             else mail = 0;
       }
       if (mail == 0) analogWrite(outPin,0);
       if ((mail > 0) && (mail < 10))
       {  
         for(myloop = 1; myloop <= mail; myloop+=1)
       // loops N times (N = new mail count)
         {
           for(pwm = 0 ; pwm <= 255; pwm+=5)
         // fade in (from min to max)
           {
             analogWrite(outPin, pwm);
         // sets the value (range from 0 to 255)
             delay(20);
         // waits for 20 milli seconds to see the dimming effect
           }
           for(pwm = 255; pwm >=0; pwm-=5)
         // fade out (from max to min)
            {
             analogWrite(outPin, pwm);
         delay(20);
            }
     
         }
         delay(2000);
       // waits 2 seconds before beginning next loop
       }
       if (mail == 10) analogWrite(outPin,40);
       //or if there is A LOT of mail, it keeps led on
       }
     

    Comentários

    This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

    Leave a Reply





    Ajuda

    • Top

      ori feher lingerie
      Orsi Fehér

    Visitante nr.:

     ^
    TOP