Arduino Automatic Email Notification

I’d like to get started on a project involving the arduino and email notifications. I’m not sure anything like this has been done before, but I’m guessing some form of it has. Let me explain. Basically I would like to set up the arduino with either some piezo sensors or a kinect so that when an action is performed (or pressure is sensed) an email (or tweet) will automatically be sent. I’m sure this can be done, but I’m not sure where to start and I wondering if anyone had an idea? Thanks in advance.

I haven’t tested the below code, but this is the most basic structure for what you’re trying to do.

On the Arduino, set setup your code to output something on the serial line (“arduino_output”) when you want to send an e-mail. Then on the computer, wait for that event.

Linux is really easy because a serial port can be treated the same as reading a file.

#!/usr/bin/perl
use open ':std';
use MIME::Lite;

#Open the COM port for reading
#just like a file
open FILE, "new(
    From        => '"FirstName LastName" <[email protected]>',
    To          => "[email protected]",
    Subject     => "subject",
    Type        => "text/plain"
);

#loop forever (until closed w/ ctrl+c)
while (1){
    while (){
        # if there is output from the arduino (ie: Serial.write(...))
        # then the e-mail will be sent
        if ($_ == "arduino_output"){
            MIME::Lite->send('smtp','mailrelay.corp.advancestores.com',Timeout=>60);
            $msg->send();
        }
    }
}

Good luck on your project.

Hello, buddy!责编内容来自:Hello, buddy! (源链) | 更多关于

阅读提示:酷辣虫无法对本内容的真实性提供任何保证,请自行验证并承担相关的风险与后果!
本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 移动开发 » Arduino Automatic Email Notification

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录