<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://wiki.mcselec.com/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.mcselec.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=MAK3</id>
		<title>MCS Wiki - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.mcselec.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=MAK3"/>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/Special:Contributions/MAK3"/>
		<updated>2026-05-09T04:34:49Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.18.6</generator>

	<entry>
		<id>https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)</id>
		<title>How to send an Email with Arduino and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-10T14:23:59Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Used Hardware&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
*Arduino UNO R3&lt;br /&gt;
*Ethernet Shield with W5100 Wiznet Chip &amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
== Used Software&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Bascom-AVR 2.0.7.6&lt;br /&gt;
&lt;br /&gt;
Windows7 or 8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== What you need to run the example&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
For the following example you need:&lt;br /&gt;
&lt;br /&gt;
*Email account which support&amp;lt;span dir=&amp;quot;auto&amp;quot;&amp;gt;SMTP Authentication&amp;lt;/span&amp;gt; (AUTH LOGIN) on Port 25&lt;br /&gt;
*Username and password Base64 encoded (you can use the Easy TCP/IP tool in Bascom-AVR to encode and decode)&lt;br /&gt;
*IP address of your smtp server (if you do not know it just open in Windows the DOS command window and ping the server)&lt;br /&gt;
*Your sender Email address and the receiver Email address&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;Don't use the Email Sub in the Do...Loop until you know what you are doing (Your mail provider could ban you if you send too much emails)&amp;amp;nbsp;!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This example use the base structure from here: [http://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100) http://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The focus of this article is Email and not other topics which are already descibed in other articels in this WIKI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You need to change the&amp;amp;nbsp; * (asterisk)&amp;amp;nbsp;!&lt;br /&gt;
&lt;br /&gt;
When you send the Email as HTML (with the Link) it might end up in your spam folder. So check also your spam folder for this email sent in HMTL format&amp;amp;nbsp;!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
' Send Email with Arduino Ethernet (W5100)&lt;br /&gt;
' Tested with GMX&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'Use Hardware:&lt;br /&gt;
' - Arduino UNO R3&lt;br /&gt;
' - Arduino Ethernet Shield with W5100 Wiznet Chip&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
' NTP Server IP address (here you can change the NTP server of your choice)&lt;br /&gt;
Const Ntp1 = 192 : Const Ntp2 = 53 : Const Ntp3 = 103 : Const Ntp4 = 108 ' Example NTP Server = 192.53.103.108&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Const Use_ping = 1 'use PING NTP server for checking NTP server availability before move on&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$regfile = &amp;quot;m328pdef.dat&amp;quot;&lt;br /&gt;
$crystal = 16000000 '16MHz&lt;br /&gt;
$hwstack = 100&lt;br /&gt;
$swstack = 100&lt;br /&gt;
$framesize = 400&lt;br /&gt;
&lt;br /&gt;
config submode = new&lt;br /&gt;
&lt;br /&gt;
Config Com1 = 57600 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Watchdog&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
config watchdog = 4096&lt;br /&gt;
Start watchdog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Server Variables&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Ip_sntp_server As Long&lt;br /&gt;
'assign the IP number of a SNTP server&lt;br /&gt;
Ip_sntp_server = Maketcp(ntp1 , Ntp2 , Ntp3 , Ntp4) 'assign IP of NTP SERVER&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Wait 2 'Time to start the Debug Terminal after flashing&lt;br /&gt;
reset watchdog&lt;br /&gt;
Print&lt;br /&gt;
Print &amp;quot;-----START Arduino UNO R3 + Ethernet Shield EMAIL DEMO-----&amp;quot;&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Network Hardware&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = Low , Phase = 0 , Clockrate = 4 , Noss = 0&lt;br /&gt;
Spiinit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Enable Interrupts&lt;br /&gt;
&lt;br /&gt;
 'Here you need MAC address, the ip address you like to use, subnet mask, gateway and localport&lt;br /&gt;
 Config Tcpip = Noint , _&lt;br /&gt;
 Mac = 1.1.94.127.1.255 , _&lt;br /&gt;
 Ip = 192.168.2.254 , _&lt;br /&gt;
 Submask = 255.255.255.0 , _&lt;br /&gt;
 Gateway = 192.168.2.1 , _&lt;br /&gt;
 Localport = 1000 , _&lt;br /&gt;
 Tx = $55 , Rx = $55 , _&lt;br /&gt;
 Chip = W5100 , _&lt;br /&gt;
 Spi = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Config Clock&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Local_time As Long&lt;br /&gt;
Dim New_second As Bit&lt;br /&gt;
dim second_counter as byte&lt;br /&gt;
&lt;br /&gt;
Config Date = Dmy , Separator = .&lt;br /&gt;
Config Clock = User&lt;br /&gt;
&lt;br /&gt;
Config Timer1 = Timer , Prescale = 256&lt;br /&gt;
On Timer1 Timer_irq Saveall 'the SAVEALL option is NEEDED !&lt;br /&gt;
Const Timer_preload = 3036&lt;br /&gt;
Enable Timer1&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' SMTP Email Variables&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Smtp_sock As Byte&lt;br /&gt;
Dim Tcp_var As Byte&lt;br /&gt;
Dim email_string As String * 130&lt;br /&gt;
Dim length as byte&lt;br /&gt;
&lt;br /&gt;
Const Smtp_email_socket = 1 'Socket Number for SMTP&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' UDP Variables&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Idx As Byte ' socket number&lt;br /&gt;
Dim Result As Word ' result&lt;br /&gt;
Dim S(255) As Byte&lt;br /&gt;
Dim R(255) As Byte&lt;br /&gt;
Dim Sstr As String * 255&lt;br /&gt;
Dim Temp As Byte , Temp2 As Byte ' temp bytes&lt;br /&gt;
Dim Ip As Long&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' PING NTP SERVER to check if NTP server is available&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
#if Use_ping = 1&lt;br /&gt;
 Dim J As Byte , Res As Byte&lt;br /&gt;
 Dim Ii As Byte&lt;br /&gt;
 Dim Ping_check_ok As Bit&lt;br /&gt;
&lt;br /&gt;
 Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
 ' FILL PING ARRAY&lt;br /&gt;
 S(1) = 8 'type is echo&lt;br /&gt;
 S(2) = 0 'code&lt;br /&gt;
&lt;br /&gt;
 S(3) = 0 ' for checksum initialization&lt;br /&gt;
 S(4) = 0 ' checksum&lt;br /&gt;
 S(5) = 0 ' a signature can be any number&lt;br /&gt;
 S(6) = 1 ' signature&lt;br /&gt;
 S(7) = 0 ' sequence number - any number&lt;br /&gt;
 S(8) = 1&lt;br /&gt;
 S(9) = 65&lt;br /&gt;
&lt;br /&gt;
 Dim W As Word At S + 2 Overlay 'same as dta(3) and dta(4)&lt;br /&gt;
 Dim B As Byte&lt;br /&gt;
 W = Tcpchecksum(s(1) , 9) ' calculate checksum and store in dta(3) and dta(4)&lt;br /&gt;
&lt;br /&gt;
 'Ip = Maketcp(192.53.103.108) 'try to check this google server&lt;br /&gt;
 Print &amp;quot;PING NTP Server : &amp;quot; ; Ip2str(ip_sntp_server)&lt;br /&gt;
&lt;br /&gt;
 'Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
 Setipprotocol Idx , 1 'set protocol to 1&lt;br /&gt;
 'the protocol value must be set BEFORE the socket is openend&lt;br /&gt;
&lt;br /&gt;
 Idx = Getsocket(idx , Sock_ipl_raw , 5000 , 0) 'RAW Socket&lt;br /&gt;
&lt;br /&gt;
 ' We try the PING 3 times (but if we get an answer we exit the for loop)&lt;br /&gt;
 Do&lt;br /&gt;
 Incr Ii&lt;br /&gt;
&lt;br /&gt;
 Result = Udpwrite(ip_sntp_server , 7 , Idx , S(1) , 9) 'write ping data '&lt;br /&gt;
 Print &amp;quot;Ping Number : &amp;quot; ; ii&lt;br /&gt;
 Waitms 200 ' depending on the hops, speed, etc&lt;br /&gt;
 Result = Socketstat(idx , Sel_recv) 'check for data&lt;br /&gt;
 ' Print &amp;quot;REC:&amp;quot; ; Result&lt;br /&gt;
 If Result &amp;gt;= 11 Then&lt;br /&gt;
&lt;br /&gt;
 Res = Tcpread(idx , R(1) , Result) 'get data with TCPREAD !!!&lt;br /&gt;
&lt;br /&gt;
 ' Print &amp;quot;DATA RETURNED :&amp;quot; ; Res&lt;br /&gt;
 '( '&lt;br /&gt;
 For J = 1 To Result&lt;br /&gt;
 Print R(j) ; &amp;quot; &amp;quot; ;&lt;br /&gt;
 Next&lt;br /&gt;
 Print&lt;br /&gt;
 ')&lt;br /&gt;
 Print &amp;quot;PING OK --&amp;gt; Exit Do..Loop&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 Set Ping_check_ok&lt;br /&gt;
&lt;br /&gt;
 Exit Do ' If we can an answer from NTP Server exit do ... loop&lt;br /&gt;
&lt;br /&gt;
 Else&lt;br /&gt;
 Print &amp;quot;NTP Server not available&amp;quot;&lt;br /&gt;
 End If&lt;br /&gt;
 Waitms 100&lt;br /&gt;
&lt;br /&gt;
 Loop Until Ii = 3&lt;br /&gt;
&lt;br /&gt;
 Ii = 0&lt;br /&gt;
#else&lt;br /&gt;
 Dim Ping_check_ok As Bit&lt;br /&gt;
 Ping_check_ok = 1&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' SNTP&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
If Ping_check_ok = 1 Then 'When the NTP Serverer responded to PING&lt;br /&gt;
 'we need to get a socket first&lt;br /&gt;
 'note that for UDP we specify sock_dgram&lt;br /&gt;
 Idx = Getsocket(idx , Sock_dgram , 1000 , 0) ' get socket for UDP mode, specify port&lt;br /&gt;
 Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
&lt;br /&gt;
 Local_time = Sntp(idx , Ip_sntp_server) ' get time from SNTP server&lt;br /&gt;
 Print &amp;quot;Local_time = &amp;quot; ; Local_time&lt;br /&gt;
&lt;br /&gt;
 If Local_time &amp;lt; 100 Then 'try it again&lt;br /&gt;
 Wait 1&lt;br /&gt;
 Local_time = Sntp(idx , Ip_sntp_server) ' get time from SNTP server&lt;br /&gt;
 Print &amp;quot;Second try ; Local_time = &amp;quot; ; Local_time&lt;br /&gt;
 End If&lt;br /&gt;
&lt;br /&gt;
 Local_time = Local_time + 3600 ' (UTC/GMT) time + 3600&lt;br /&gt;
 Print Date(local_time) ; Spc(3) ; Time(local_time)&lt;br /&gt;
End If&lt;br /&gt;
&lt;br /&gt;
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++&lt;br /&gt;
' +&lt;br /&gt;
' + SUB NAME: Send_Email()&lt;br /&gt;
' +&lt;br /&gt;
' + DESCRIPTION: Send Email&lt;br /&gt;
' +&lt;br /&gt;
' +&lt;br /&gt;
' + RETURN: None&lt;br /&gt;
' +&lt;br /&gt;
' + NOTES: None&lt;br /&gt;
' +&lt;br /&gt;
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++&lt;br /&gt;
'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sub Send_Email(byval Send_html As Byte) ' 0 = send Text, 1 = send HTML&lt;br /&gt;
&lt;br /&gt;
 '---------------------[SEND EMAIL SMTP]-----------------------------------------&lt;br /&gt;
 'for SMTP Email first we need a socket&lt;br /&gt;
 idx = Getsocket(smtp_email_socket , Sock_stream , 4086 , 0)&lt;br /&gt;
 If idx = 255 Then print &amp;quot;SMTP Email Getsocket Error&amp;quot;&lt;br /&gt;
'(&lt;br /&gt;
 result = Socketstat(idx , Sel_control)&lt;br /&gt;
&lt;br /&gt;
 Select Case result&lt;br /&gt;
 Case Sock_closed : print &amp;quot;Sock_closedr&amp;quot;&lt;br /&gt;
 Case Sock_arp : print &amp;quot;SOCK_ARP&amp;quot;&lt;br /&gt;
 Case Sock_listen : print &amp;quot;SOCK_LISTEN&amp;quot;&lt;br /&gt;
 Case Sock_synsent : print &amp;quot;SOCK_SYNSENT&amp;quot;&lt;br /&gt;
 Case Sock_synrecv : print &amp;quot;SOCK_SYNRECV&amp;quot;&lt;br /&gt;
 Case Sock_established : print &amp;quot;SOCK_ESTABLISHED&amp;quot;&lt;br /&gt;
 Case Sock_close_wait : print &amp;quot;SOCK_CLOSE_WAIT&amp;quot;&lt;br /&gt;
 Case Sock_last_ack : print &amp;quot;SOCK_LAST_ACK&amp;quot;&lt;br /&gt;
 Case Sock_fin_wait : print &amp;quot;SOCK_FIN_WAIT&amp;quot;&lt;br /&gt;
 Case Sock_closing : print &amp;quot;SOCK_CLOSING&amp;quot;&lt;br /&gt;
 Case Sock_time_wait : print &amp;quot;SOCK_TIME_WAIT&amp;quot;&lt;br /&gt;
 Case Sock_init : print &amp;quot;SOCK_INIT&amp;quot;&lt;br /&gt;
 Case Sock_udp : print &amp;quot;SOCK_UDP&amp;quot;&lt;br /&gt;
 Case Sock_raw : print &amp;quot;SOCK_RAW&amp;quot;&lt;br /&gt;
 Case Sock_macraw : print &amp;quot;SOCK_MACRAW&amp;quot;&lt;br /&gt;
 Case Sock_ppoe : print &amp;quot;SOCK_PPOE&amp;quot;&lt;br /&gt;
 End Select&lt;br /&gt;
')&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 'connect to smtp server&lt;br /&gt;
 result = Socketconnect(idx , 213.165.64.21 , 25) ' smtp server and SMTP port 25&lt;br /&gt;
 ' ^socket&lt;br /&gt;
 ' ^ ip address of the smtp server&lt;br /&gt;
 ' ^ port 25 for smtp&lt;br /&gt;
 print &amp;quot;Connecting to GMX Email Server: &amp;quot; ; &amp;quot; 213.165.64.21 Port 25 &amp;quot;&lt;br /&gt;
&lt;br /&gt;
 print &amp;quot;Socketconnect Status = &amp;quot; ; result&lt;br /&gt;
 If result = 1 Then print &amp;quot;ERROR connecting to 213.165.64.21 Port 25&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
 Do&lt;br /&gt;
 result = Socketstat(idx , 0) ' get socket status&lt;br /&gt;
 Loop Until result = Sock_established&lt;br /&gt;
&lt;br /&gt;
 print &amp;quot;SMTP = &amp;quot; ; &amp;quot;SOCK_ESTABLISHED&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
 Do&lt;br /&gt;
 Tcp_var = Tcpread(idx , email_string) ' get response from SMTP server&lt;br /&gt;
 If Left(email_string , 3) = &amp;quot;220&amp;quot; Then&lt;br /&gt;
 print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
 Exit Do&lt;br /&gt;
 End If&lt;br /&gt;
 'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
 Loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 print &amp;quot;Send &amp;quot; ; &amp;quot;HELO Arduino Ethernet{013}{010}&amp;quot;&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;HELO Arduino Ethernet{013}{010}&amp;quot; ) ' send username&lt;br /&gt;
 print Tcp_var ; &amp;quot; bytes written&amp;quot; ' number of bytes actual send&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Do&lt;br /&gt;
 Tcp_var = Tcpread(idx , email_string) ' get response from SMTP server&lt;br /&gt;
&lt;br /&gt;
 If Left(email_string , 3) = &amp;quot;250&amp;quot; Then&lt;br /&gt;
 print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
 Exit Do&lt;br /&gt;
 End If&lt;br /&gt;
 'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
 Loop&lt;br /&gt;
&lt;br /&gt;
 Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 print &amp;quot;Send &amp;quot; ; &amp;quot;AUTH LOGIN{013}{010}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;AUTH LOGIN{013}{010}&amp;quot; ) 'authentication login&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Do&lt;br /&gt;
 Tcp_var = Tcpread(idx , email_string) ' get response from SMTP server&lt;br /&gt;
 If Left(email_string , 3) = &amp;quot;334&amp;quot; Then&lt;br /&gt;
 print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
 Exit Do&lt;br /&gt;
 End If&lt;br /&gt;
 'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
 Loop&lt;br /&gt;
&lt;br /&gt;
 Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
 'The username must be Base64 encoded (and add the CR + LF)!&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;**********************=={013}{010}&amp;quot; ) 'USERNAME&lt;br /&gt;
&lt;br /&gt;
 Do&lt;br /&gt;
 Tcp_var = Tcpread(idx , email_string) ' get response from SMTP server&lt;br /&gt;
 If Left(email_string , 3) = &amp;quot;334&amp;quot; Then&lt;br /&gt;
 print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
 Exit Do&lt;br /&gt;
 End If&lt;br /&gt;
 'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
 Loop&lt;br /&gt;
&lt;br /&gt;
 Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
 'The password must be Base64 encoded (and add the CR + LF) !&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;********************=={013}{010}&amp;quot; ) 'PASSWORD&lt;br /&gt;
&lt;br /&gt;
 Do&lt;br /&gt;
 Tcp_var = Tcpread(idx , email_string) ' get response from SMTP server&lt;br /&gt;
 If Left(email_string , 3) = &amp;quot;235&amp;quot; Then&lt;br /&gt;
 print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
 Exit Do&lt;br /&gt;
 End If&lt;br /&gt;
 'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
 Loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
 'Your Email address&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;MAIL FROM: *********@***.com{013}{010}&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 Do&lt;br /&gt;
 Tcp_var = Tcpread(idx , email_string) ' get response from SMTP server&lt;br /&gt;
 If Left(email_string , 3) = &amp;quot;250&amp;quot; Then&lt;br /&gt;
 print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
 Exit Do&lt;br /&gt;
 End If&lt;br /&gt;
 'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
 Loop&lt;br /&gt;
&lt;br /&gt;
 Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
 'The Email address you want to send the message to&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;RCPT TO: ******@*****.com{013}{010}&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Do&lt;br /&gt;
 Tcp_var = Tcpread(idx , email_string) ' get response from SMTP server&lt;br /&gt;
 If Left(email_string , 3) = &amp;quot;250&amp;quot; Then&lt;br /&gt;
 print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
 Exit Do&lt;br /&gt;
 End If&lt;br /&gt;
 'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
 Loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;DATA{013}{010}&amp;quot; )&lt;br /&gt;
&lt;br /&gt;
 Do&lt;br /&gt;
 Tcp_var = Tcpread(idx , email_string) ' get response from SMTP server&lt;br /&gt;
 If Left(email_string , 3) = &amp;quot;354&amp;quot; Then&lt;br /&gt;
 print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
 Exit Do&lt;br /&gt;
 End If&lt;br /&gt;
 'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
 Loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;FROM: ********@***.de{013}{010}&amp;quot;)&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;TO: *******@****.com{013}{010}&amp;quot;)&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;SUBJECT: Arduino Ethernet Bascom{013}{010}&amp;quot;)&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;X-Mailer: BASCOM SMTP{013}{010}&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 If Send_html = 1 Then&lt;br /&gt;
 '----------------------Send the Email as HTML ---------------------------&lt;br /&gt;
&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;Mime-Version: 1.0;{013}{010}&amp;quot;)&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;Content-Type: text/html; charset={034}ISO-8859-1{034};{013}{010}&amp;quot;)&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;Content-Transfer-Encoding: 7bit;{013}{010}&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;{013}{010}&amp;quot;) 'Empty line to switch to body&lt;br /&gt;
&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;html&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;body&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;h2&amp;gt;The Link to Bascom Forum !&amp;lt;/h2&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;Here is it: &amp;lt;a href={034}http://www.mcselec.com/index2.php?option=com_forum&amp;amp;Itemid=59{034}&amp;gt;Bascom Forum&amp;lt;/a&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;p&amp;gt;Best Regards,&amp;lt;/p&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;p&amp;gt;Arduino Ethernet Bascom&amp;lt;/p&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;/body&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;/html&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;.{013}{010}&amp;quot;)&lt;br /&gt;
 Else&lt;br /&gt;
&lt;br /&gt;
 '-----------------------Send only TEXT-----------------------------------&lt;br /&gt;
&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;{013}{010}&amp;quot;) 'Empty line to switch from subject to body&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;This is a test email from BASCOM-AVR SMTP{013}{010}&amp;quot;)&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;Arduino Ethernet Bascom{013}{010}&amp;quot;)&lt;br /&gt;
 email_string = &amp;quot;Timestamp = &amp;quot; + time$ + &amp;quot; / &amp;quot; + date$ + &amp;quot;{013}{010}&amp;quot;&lt;br /&gt;
 length = len(email_string)&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , email_string, length)&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;.{013}{010}&amp;quot;) ' end with a single dot&lt;br /&gt;
 end if&lt;br /&gt;
&lt;br /&gt;
 Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
 Do&lt;br /&gt;
 Tcp_var = Tcpread(idx , email_string) ' get response from SMTP server&lt;br /&gt;
 If Left(email_string , 3) = &amp;quot;250&amp;quot; Then&lt;br /&gt;
 print &amp;quot;Server Answer = &amp;quot; ; email_string '--&amp;gt; 250 2.6.0 Message accepted&lt;br /&gt;
 Exit Do&lt;br /&gt;
 End If&lt;br /&gt;
 'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
 Loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 print &amp;quot;Send &amp;quot; ; &amp;quot;QUIT{013}{010}&amp;quot;&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;QUIT{013}{010}&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Do&lt;br /&gt;
 Tcp_var = Tcpread(idx , email_string) ' get response from SMTP server&lt;br /&gt;
 If Left(email_string , 3) = &amp;quot;221&amp;quot; Then&lt;br /&gt;
 print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
 Exit Do&lt;br /&gt;
 End If&lt;br /&gt;
 'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
 Loop&lt;br /&gt;
&lt;br /&gt;
 Print &amp;quot;Close Socket&amp;quot;&lt;br /&gt;
 Closesocket Idx ' close the server connection&lt;br /&gt;
&lt;br /&gt;
End Sub&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
reset watchdog&lt;br /&gt;
&lt;br /&gt;
'Here we send the email&lt;br /&gt;
&lt;br /&gt;
call Send_Email(0) 'Send text Email&lt;br /&gt;
wait 2 : reset watchdog&lt;br /&gt;
call Send_Email(1) 'Send Email in HTML&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Do&lt;br /&gt;
 If New_second = 1 Then&lt;br /&gt;
 Reset New_second&lt;br /&gt;
 reset watchdog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 'Do something every second ......&lt;br /&gt;
&lt;br /&gt;
 print &amp;quot;Tick&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 incr second_counter&lt;br /&gt;
 if second_counter = 180 then&lt;br /&gt;
 second_counter = 0&lt;br /&gt;
 'Do something every 3 minutes ......&lt;br /&gt;
 end if&lt;br /&gt;
 End If&lt;br /&gt;
Loop&lt;br /&gt;
&lt;br /&gt;
End&lt;br /&gt;
&lt;br /&gt;
Timer_irq:&lt;br /&gt;
 Incr Local_time&lt;br /&gt;
 Time$ = Time(local_time)&lt;br /&gt;
 Date$ = Date(local_time)&lt;br /&gt;
 Set New_second&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Getdatetime:&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Settime:&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Setdate:&lt;br /&gt;
Return&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Terminal Ouput of Example&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;-----START Arduino UNO R3 + Ethernet Shield EMAIL DEMO-----&amp;lt;br/&amp;gt;PING NTP Server&amp;amp;nbsp;: 192.53.103.108&amp;lt;br/&amp;gt;Ping Number&amp;amp;nbsp;: 1&amp;lt;br/&amp;gt;PING OK --&amp;gt; Exit Do..Loop&amp;lt;br/&amp;gt;Socket 0 0&amp;lt;br/&amp;gt;Local_time = 416239374&amp;lt;br/&amp;gt;10.03.13&amp;amp;nbsp;&amp;amp;nbsp; 15:02:54&amp;lt;br/&amp;gt;Connecting to GMX Email Server:&amp;amp;nbsp; 213.165.64.21 Port 25&amp;lt;br/&amp;gt;Socketconnect Status = 0&amp;lt;br/&amp;gt;SMTP = SOCK_ESTABLISHED&amp;lt;br/&amp;gt;Server Answer = 220 mail.gmx.net GMX Mailservices ESMTP {mp033}&amp;lt;br/&amp;gt;Send HELO Arduino Ethernet&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;23&amp;amp;nbsp; bytes written&amp;lt;br/&amp;gt;Server Answer = 250 mail.gmx.net GMX Mailservices {mp033}&amp;lt;br/&amp;gt;Send AUTH LOGIN&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;Server Answer = 334 VXNlcm5hbWU6&amp;lt;br/&amp;gt;Server Answer = 334 UGFzc3dvcmQ6&amp;lt;br/&amp;gt;Server Answer = 235 2.7.0 Go ahead {mp033}&amp;lt;br/&amp;gt;Server Answer = 250 2.1.0 ok {mp033}&amp;lt;br/&amp;gt;Server Answer = 250 2.1.5 ok {mp033}&amp;lt;br/&amp;gt;Server Answer = 354 mail.gmx.net Go ahead {mp033}&amp;lt;br/&amp;gt;Server Answer = 250 2.6.0 Message accepted {mp033}&amp;lt;br/&amp;gt;Send QUIT&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;Server Answer = 221 2.0.0 GMX Mailservices {mp033}&amp;lt;br/&amp;gt;Close Socket&amp;lt;br/&amp;gt;Connecting to GMX Email Server:&amp;amp;nbsp; 213.165.64.21 Port 25&amp;lt;br/&amp;gt;Socketconnect Status = 0&amp;lt;br/&amp;gt;SMTP = SOCK_ESTABLISHED&amp;lt;br/&amp;gt;Server Answer = 220 mail.gmx.net GMX Mailservices ESMTP {mp033}&amp;lt;br/&amp;gt;Send HELO Arduino Ethernet&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;23&amp;amp;nbsp; bytes written&amp;lt;br/&amp;gt;Server Answer = 250 mail.gmx.net GMX Mailservices {mp033}&amp;lt;br/&amp;gt;Send AUTH LOGIN&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;Server Answer = 334 VXNlcm5hbWU6&amp;lt;br/&amp;gt;Server Answer = 334 UGFzc3dvcmQ6&amp;lt;br/&amp;gt;Server Answer = 235 2.7.0 Go ahead {mp033}&amp;lt;br/&amp;gt;Server Answer = 250 2.1.0 ok {mp033}&amp;lt;br/&amp;gt;Server Answer = 250 2.1.5 ok {mp033}&amp;lt;br/&amp;gt;Server Answer = 354 mail.gmx.net Go ahead {mp033}&amp;lt;br/&amp;gt;Server Answer = 250 2.6.0 Message accepted {mp033}&amp;lt;br/&amp;gt;Send QUIT&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;Server Answer = 221 2.0.0 GMX Mailservices {mp033}&amp;lt;br/&amp;gt;Close Socket&amp;lt;br/&amp;gt;Tick&amp;lt;br/&amp;gt;Tick&amp;lt;br/&amp;gt;Tick&amp;lt;br/&amp;gt;Tick&amp;lt;br/&amp;gt;Tick&amp;lt;br/&amp;gt;Tick&amp;lt;br/&amp;gt;Tick&amp;lt;br/&amp;gt;Tick&amp;lt;br/&amp;gt;Tick&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Telnet Exercise with sending an Email (if you encounter a problem)&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The AUTH LOGIN smtp command is used to login to the smtp server with Username and password (both must be sent Base64 encoded).&lt;br /&gt;
&lt;br /&gt;
You can use the Easy TCP/IP Tool in Bascom-AVR to decode or encode Base64.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;You can check all the single steps of the SMTP server communication with TELNET in a manual procedure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;1. Enabling Telnet Client in Windows 7&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp; [http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx]&amp;lt;br/&amp;gt;2. Start the DOS command window in Windows 7 and type telnet and return&amp;lt;br/&amp;gt;3. Then you see:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; Microsoft Telnet&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; in the DOS command window.&amp;lt;br/&amp;gt;4. Now type (we use as example GMX with Port 25):&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; open smtp.gmx.net 25&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; (25 is the port number)&amp;lt;br/&amp;gt;5. The answer from the SMTP server will be: &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;220 mail.gmx.net GMX Mailservices ESMTP {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;6. Then type:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; AUTH LOGIN&amp;lt;br/&amp;gt;7. The answer from the SMTP server will be: 334 &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;VXNlcm5hbWU6&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;8. If you decode the&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;VXNlcm5hbWU6&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;/span&amp;gt;for example with the Easy TCP/IP Tool in Bascom-AVR&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; you will notice that the decoded text is &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Username:&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;9. You need now to type in the username Base64 encoded (which is usually your Email address Base64 encoded)&amp;lt;br/&amp;gt;10. After this the SMTP server ask for the password (also Base64 encoded)&amp;lt;br/&amp;gt;11. If you type in the wrong username or password the server's answer is &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;535 5.7.0 Incorrect username or password {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;12. The correct username and password will be answerd by:&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;235 2.7.0 Go ahead {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;13. ...&amp;lt;br/&amp;gt;14. You can start the Email content with DATA and end it with &amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt;.&amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt; '''which is in Bascom {013}{010}.{013}{010}'''&lt;br /&gt;
&lt;br /&gt;
== SMTP Server Reply Codes&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Code Description&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;211 System status, or system help reply.&amp;lt;br/&amp;gt;214 Help message.&amp;lt;br/&amp;gt;220 Domain service ready.Ready to start TLS.&amp;lt;br/&amp;gt;221 Domain service closing transmission channel.&amp;lt;br/&amp;gt;250 Ok , Queuing For Node Node Started.requested Mail Action Okay , Completed.&amp;lt;br/&amp;gt;251 Ok , No Messages Waiting For Node Node.user Not Local , Will Forward To Forwardpath.&amp;lt;br/&amp;gt;252 OK, pending messages for node node started.Cannot VRFY user (e.g., info is not local), but will take message for this user and attempt delivery.&amp;lt;br/&amp;gt;253 OK, messages pending messages for node node started.&amp;lt;br/&amp;gt;354 Start mail input; end with &amp;amp;lt;CRLF&amp;amp;gt;.&amp;amp;lt;CRLF&amp;amp;gt;.&amp;lt;br/&amp;gt;355 Octet-offset is the transaction offset.&amp;lt;br/&amp;gt;421 Domain Service Not Available , Closing Transmission Channel.&amp;lt;br/&amp;gt;432 A password transition is needed.&amp;lt;br/&amp;gt;450 Requested mail action not taken: mailbox unavailable.ATRN request refused.&amp;lt;br/&amp;gt;451 Requested action aborted: local error in processing.Unable to process ATRN request now&amp;lt;br/&amp;gt;452 Requested action not taken: insufficient system storage.&amp;lt;br/&amp;gt;453 You have no mail.&amp;lt;br/&amp;gt;454 TLS not available due to temporary reason.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;458 Unable to queue messages for node node.&amp;lt;br/&amp;gt;459 Node node not allowed: reason.&amp;lt;br/&amp;gt;500 Command not recognized: command.Syntax error.&amp;lt;br/&amp;gt;501 Syntax error, no parameters allowed.&amp;lt;br/&amp;gt;502 Command not implemented.&amp;lt;br/&amp;gt;503 Bad sequence of commands.&amp;lt;br/&amp;gt;504 Command parameter not implemented.&amp;lt;br/&amp;gt;521 Machine does not accept mail.&amp;lt;br/&amp;gt;530 Must issue a STARTTLS command first.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;534 Authentication mechanism is too weak.&amp;lt;br/&amp;gt;538 Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;550 Requested action not taken: mailbox unavailable.&amp;lt;br/&amp;gt;551 User not local; please try forwardpath.&amp;lt;br/&amp;gt;552 Requested mail action aborted: exceeded storage allocation.&amp;lt;br/&amp;gt;553 Requested action not taken: mailbox name not allowed.&amp;lt;br/&amp;gt;554 Transaction failed.&lt;br /&gt;
&lt;br /&gt;
== Author&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
MAK3&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Arduino Ethernet with Bascom-AVR]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)</id>
		<title>How to send an Email with Arduino and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-10T14:21:21Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Used Hardware&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
*Arduino UNO R3&lt;br /&gt;
*Ethernet Shield with W5100 Wiznet Chip &amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
== Used Software&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Bascom-AVR 2.0.7.6&lt;br /&gt;
&lt;br /&gt;
Windows7 or 8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== What you need to run the example&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
For the following example you need:&lt;br /&gt;
&lt;br /&gt;
*Email account which support&amp;lt;span dir=&amp;quot;auto&amp;quot;&amp;gt;SMTP Authentication&amp;lt;/span&amp;gt; (AUTH LOGIN) on Port 25&lt;br /&gt;
*Username and password Base64 encoded (you can use the Easy TCP/IP tool in Bascom-AVR to encode and decode)&lt;br /&gt;
*IP address of your smtp server (if you do not know it just open in Windows the DOS command window and ping the server)&lt;br /&gt;
*Your sender Email address and the receiver Email address&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;Don't use the Email Sub in the Do...Loop until you know what you are doing (Your mail provider could ban you if you send too much emails)&amp;amp;nbsp;!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This example use the base structure from here: [http://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100) http://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The focus of this article is Email and not other topics which are already descibed in other articels in this WIKI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You need to change the&amp;amp;nbsp; * (asterisk)&amp;amp;nbsp;!&lt;br /&gt;
&lt;br /&gt;
When you send the Email as HTML (with the Link) it might end up in your spam folder. So check also your spam folder for this email sent in HMTL format&amp;amp;nbsp;!&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
' Send Email with Arduino Ethernet (W5100)&lt;br /&gt;
' Tested with GMX&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'Use Hardware:&lt;br /&gt;
' - Arduino UNO R3&lt;br /&gt;
' - Arduino Ethernet Shield with W5100 Wiznet Chip&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
' NTP Server IP address (here you can change the NTP server of your choice)&lt;br /&gt;
Const Ntp1 = 192 : Const Ntp2 = 53 : Const Ntp3 = 103 : Const Ntp4 = 108 ' Example NTP Server = 192.53.103.108&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Const Use_ping = 1 'use PING NTP server for checking NTP server availability before move on&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$regfile = &amp;quot;m328pdef.dat&amp;quot;&lt;br /&gt;
$crystal = 16000000 '16MHz&lt;br /&gt;
$hwstack = 100&lt;br /&gt;
$swstack = 100&lt;br /&gt;
$framesize = 400&lt;br /&gt;
&lt;br /&gt;
config submode = new&lt;br /&gt;
&lt;br /&gt;
Config Com1 = 57600 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Watchdog&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
config watchdog = 4096&lt;br /&gt;
Start watchdog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Server Variables&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Ip_sntp_server As Long&lt;br /&gt;
'assign the IP number of a SNTP server&lt;br /&gt;
Ip_sntp_server = Maketcp(ntp1 , Ntp2 , Ntp3 , Ntp4) 'assign IP of NTP SERVER&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Wait 2 'Time to start the Debug Terminal after flashing&lt;br /&gt;
reset watchdog&lt;br /&gt;
Print&lt;br /&gt;
Print &amp;quot;-----START Arduino UNO R3 + Ethernet Shield EMAIL DEMO-----&amp;quot;&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Network Hardware&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = Low , Phase = 0 , Clockrate = 4 , Noss = 0&lt;br /&gt;
Spiinit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Enable Interrupts&lt;br /&gt;
&lt;br /&gt;
 'Here you need MAC address, the ip address you like to use, subnet mask, gateway and localport&lt;br /&gt;
 Config Tcpip = Noint , _&lt;br /&gt;
 Mac = 1.1.94.127.1.255 , _&lt;br /&gt;
 Ip = 192.168.2.254 , _&lt;br /&gt;
 Submask = 255.255.255.0 , _&lt;br /&gt;
 Gateway = 192.168.2.1 , _&lt;br /&gt;
 Localport = 1000 , _&lt;br /&gt;
 Tx = $55 , Rx = $55 , _&lt;br /&gt;
 Chip = W5100 , _&lt;br /&gt;
 Spi = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Config Clock&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Local_time As Long&lt;br /&gt;
Dim New_second As Bit&lt;br /&gt;
dim second_counter as byte&lt;br /&gt;
&lt;br /&gt;
Config Date = Dmy , Separator = .&lt;br /&gt;
Config Clock = User&lt;br /&gt;
&lt;br /&gt;
Config Timer1 = Timer , Prescale = 256&lt;br /&gt;
On Timer1 Timer_irq Saveall 'the SAVEALL option is NEEDED !&lt;br /&gt;
Const Timer_preload = 3036&lt;br /&gt;
Enable Timer1&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' SMTP Email Variables&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Smtp_sock As Byte&lt;br /&gt;
Dim Tcp_var As Byte&lt;br /&gt;
Dim email_string As String * 130&lt;br /&gt;
Dim length as byte&lt;br /&gt;
&lt;br /&gt;
Const Smtp_email_socket = 1 'Socket Number for SMTP&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' UDP Variables&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Idx As Byte ' socket number&lt;br /&gt;
Dim Result As Word ' result&lt;br /&gt;
Dim S(255) As Byte&lt;br /&gt;
Dim R(255) As Byte&lt;br /&gt;
Dim Sstr As String * 255&lt;br /&gt;
Dim Temp As Byte , Temp2 As Byte ' temp bytes&lt;br /&gt;
Dim Ip As Long&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' PING NTP SERVER to check if NTP server is available&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
#if Use_ping = 1&lt;br /&gt;
 Dim J As Byte , Res As Byte&lt;br /&gt;
 Dim Ii As Byte&lt;br /&gt;
 Dim Ping_check_ok As Bit&lt;br /&gt;
&lt;br /&gt;
 Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
 ' FILL PING ARRAY&lt;br /&gt;
 S(1) = 8 'type is echo&lt;br /&gt;
 S(2) = 0 'code&lt;br /&gt;
&lt;br /&gt;
 S(3) = 0 ' for checksum initialization&lt;br /&gt;
 S(4) = 0 ' checksum&lt;br /&gt;
 S(5) = 0 ' a signature can be any number&lt;br /&gt;
 S(6) = 1 ' signature&lt;br /&gt;
 S(7) = 0 ' sequence number - any number&lt;br /&gt;
 S(8) = 1&lt;br /&gt;
 S(9) = 65&lt;br /&gt;
&lt;br /&gt;
 Dim W As Word At S + 2 Overlay 'same as dta(3) and dta(4)&lt;br /&gt;
 Dim B As Byte&lt;br /&gt;
 W = Tcpchecksum(s(1) , 9) ' calculate checksum and store in dta(3) and dta(4)&lt;br /&gt;
&lt;br /&gt;
 'Ip = Maketcp(192.53.103.108) 'try to check this google server&lt;br /&gt;
 Print &amp;quot;PING NTP Server : &amp;quot; ; Ip2str(ip_sntp_server)&lt;br /&gt;
&lt;br /&gt;
 'Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
 Setipprotocol Idx , 1 'set protocol to 1&lt;br /&gt;
 'the protocol value must be set BEFORE the socket is openend&lt;br /&gt;
&lt;br /&gt;
 Idx = Getsocket(idx , Sock_ipl_raw , 5000 , 0) 'RAW Socket&lt;br /&gt;
&lt;br /&gt;
 ' We try the PING 3 times (but if we get an answer we exit the for loop)&lt;br /&gt;
 Do&lt;br /&gt;
 Incr Ii&lt;br /&gt;
&lt;br /&gt;
 Result = Udpwrite(ip_sntp_server , 7 , Idx , S(1) , 9) 'write ping data '&lt;br /&gt;
 Print &amp;quot;Ping Number : &amp;quot; ; ii&lt;br /&gt;
 Waitms 200 ' depending on the hops, speed, etc&lt;br /&gt;
 Result = Socketstat(idx , Sel_recv) 'check for data&lt;br /&gt;
 ' Print &amp;quot;REC:&amp;quot; ; Result&lt;br /&gt;
 If Result &amp;gt;= 11 Then&lt;br /&gt;
&lt;br /&gt;
 Res = Tcpread(idx , R(1) , Result) 'get data with TCPREAD !!!&lt;br /&gt;
&lt;br /&gt;
 ' Print &amp;quot;DATA RETURNED :&amp;quot; ; Res&lt;br /&gt;
 '( '&lt;br /&gt;
 For J = 1 To Result&lt;br /&gt;
 Print R(j) ; &amp;quot; &amp;quot; ;&lt;br /&gt;
 Next&lt;br /&gt;
 Print&lt;br /&gt;
 ')&lt;br /&gt;
 Print &amp;quot;PING OK --&amp;gt; Exit Do..Loop&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 Set Ping_check_ok&lt;br /&gt;
&lt;br /&gt;
 Exit Do ' If we can an answer from NTP Server exit do ... loop&lt;br /&gt;
&lt;br /&gt;
 Else&lt;br /&gt;
 Print &amp;quot;NTP Server not available&amp;quot;&lt;br /&gt;
 End If&lt;br /&gt;
 Waitms 100&lt;br /&gt;
&lt;br /&gt;
 Loop Until Ii = 3&lt;br /&gt;
&lt;br /&gt;
 Ii = 0&lt;br /&gt;
#else&lt;br /&gt;
 Dim Ping_check_ok As Bit&lt;br /&gt;
 Ping_check_ok = 1&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' SNTP&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
If Ping_check_ok = 1 Then 'When the NTP Serverer responded to PING&lt;br /&gt;
 'we need to get a socket first&lt;br /&gt;
 'note that for UDP we specify sock_dgram&lt;br /&gt;
 Idx = Getsocket(idx , Sock_dgram , 1000 , 0) ' get socket for UDP mode, specify port&lt;br /&gt;
 Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
&lt;br /&gt;
 Local_time = Sntp(idx , Ip_sntp_server) ' get time from SNTP server&lt;br /&gt;
 Print &amp;quot;Local_time = &amp;quot; ; Local_time&lt;br /&gt;
&lt;br /&gt;
 If Local_time &amp;lt; 100 Then 'try it again&lt;br /&gt;
 Wait 1&lt;br /&gt;
 Local_time = Sntp(idx , Ip_sntp_server) ' get time from SNTP server&lt;br /&gt;
 Print &amp;quot;Second try ; Local_time = &amp;quot; ; Local_time&lt;br /&gt;
 End If&lt;br /&gt;
&lt;br /&gt;
 Local_time = Local_time + 3600 ' (UTC/GMT) time + 3600&lt;br /&gt;
 Print Date(local_time) ; Spc(3) ; Time(local_time)&lt;br /&gt;
End If&lt;br /&gt;
&lt;br /&gt;
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++&lt;br /&gt;
' +&lt;br /&gt;
' + SUB NAME: Send_Email()&lt;br /&gt;
' +&lt;br /&gt;
' + DESCRIPTION: Send Email&lt;br /&gt;
' +&lt;br /&gt;
' +&lt;br /&gt;
' + RETURN: None&lt;br /&gt;
' +&lt;br /&gt;
' + NOTES: None&lt;br /&gt;
' +&lt;br /&gt;
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++&lt;br /&gt;
'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sub Send_Email(byval Send_html As Byte) ' 0 = send Text, 1 = send HTML&lt;br /&gt;
&lt;br /&gt;
 '---------------------[SEND EMAIL SMTP]-----------------------------------------&lt;br /&gt;
 'for SMTP Email first we need a socket&lt;br /&gt;
 idx = Getsocket(smtp_email_socket , Sock_stream , 4086 , 0)&lt;br /&gt;
 If idx = 255 Then print &amp;quot;SMTP Email Getsocket Error&amp;quot;&lt;br /&gt;
'(&lt;br /&gt;
 result = Socketstat(idx , Sel_control)&lt;br /&gt;
&lt;br /&gt;
 Select Case result&lt;br /&gt;
 Case Sock_closed : print &amp;quot;Sock_closedr&amp;quot;&lt;br /&gt;
 Case Sock_arp : print &amp;quot;SOCK_ARP&amp;quot;&lt;br /&gt;
 Case Sock_listen : print &amp;quot;SOCK_LISTEN&amp;quot;&lt;br /&gt;
 Case Sock_synsent : print &amp;quot;SOCK_SYNSENT&amp;quot;&lt;br /&gt;
 Case Sock_synrecv : print &amp;quot;SOCK_SYNRECV&amp;quot;&lt;br /&gt;
 Case Sock_established : print &amp;quot;SOCK_ESTABLISHED&amp;quot;&lt;br /&gt;
 Case Sock_close_wait : print &amp;quot;SOCK_CLOSE_WAIT&amp;quot;&lt;br /&gt;
 Case Sock_last_ack : print &amp;quot;SOCK_LAST_ACK&amp;quot;&lt;br /&gt;
 Case Sock_fin_wait : print &amp;quot;SOCK_FIN_WAIT&amp;quot;&lt;br /&gt;
 Case Sock_closing : print &amp;quot;SOCK_CLOSING&amp;quot;&lt;br /&gt;
 Case Sock_time_wait : print &amp;quot;SOCK_TIME_WAIT&amp;quot;&lt;br /&gt;
 Case Sock_init : print &amp;quot;SOCK_INIT&amp;quot;&lt;br /&gt;
 Case Sock_udp : print &amp;quot;SOCK_UDP&amp;quot;&lt;br /&gt;
 Case Sock_raw : print &amp;quot;SOCK_RAW&amp;quot;&lt;br /&gt;
 Case Sock_macraw : print &amp;quot;SOCK_MACRAW&amp;quot;&lt;br /&gt;
 Case Sock_ppoe : print &amp;quot;SOCK_PPOE&amp;quot;&lt;br /&gt;
 End Select&lt;br /&gt;
')&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 'connect to smtp server&lt;br /&gt;
 result = Socketconnect(idx , 213.165.64.21 , 25) ' smtp server and SMTP port 25&lt;br /&gt;
 ' ^socket&lt;br /&gt;
 ' ^ ip address of the smtp server&lt;br /&gt;
 ' ^ port 25 for smtp&lt;br /&gt;
 print &amp;quot;Connecting to GMX Email Server: &amp;quot; ; &amp;quot; 213.165.64.21 Port 25 &amp;quot;&lt;br /&gt;
&lt;br /&gt;
 print &amp;quot;Socketconnect Status = &amp;quot; ; result&lt;br /&gt;
 If result = 1 Then print &amp;quot;ERROR connecting to 213.165.64.21 Port 25&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
 Do&lt;br /&gt;
 result = Socketstat(idx , 0) ' get socket status&lt;br /&gt;
 Loop Until result = Sock_established&lt;br /&gt;
&lt;br /&gt;
 print &amp;quot;SMTP = &amp;quot; ; &amp;quot;SOCK_ESTABLISHED&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
 Do&lt;br /&gt;
 Tcp_var = Tcpread(idx , email_string) ' get response from SMTP server&lt;br /&gt;
 If Left(email_string , 3) = &amp;quot;220&amp;quot; Then&lt;br /&gt;
 print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
 Exit Do&lt;br /&gt;
 End If&lt;br /&gt;
 'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
 Loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 print &amp;quot;Send &amp;quot; ; &amp;quot;HELO Arduino Ethernet{013}{010}&amp;quot;&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;HELO Arduino Ethernet{013}{010}&amp;quot; ) ' send username&lt;br /&gt;
 print Tcp_var ; &amp;quot; bytes written&amp;quot; ' number of bytes actual send&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Do&lt;br /&gt;
 Tcp_var = Tcpread(idx , email_string) ' get response from SMTP server&lt;br /&gt;
&lt;br /&gt;
 If Left(email_string , 3) = &amp;quot;250&amp;quot; Then&lt;br /&gt;
 print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
 Exit Do&lt;br /&gt;
 End If&lt;br /&gt;
 'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
 Loop&lt;br /&gt;
&lt;br /&gt;
 Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 print &amp;quot;Send &amp;quot; ; &amp;quot;AUTH LOGIN{013}{010}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;AUTH LOGIN{013}{010}&amp;quot; ) 'authentication login&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Do&lt;br /&gt;
 Tcp_var = Tcpread(idx , email_string) ' get response from SMTP server&lt;br /&gt;
 If Left(email_string , 3) = &amp;quot;334&amp;quot; Then&lt;br /&gt;
 print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
 Exit Do&lt;br /&gt;
 End If&lt;br /&gt;
 'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
 Loop&lt;br /&gt;
&lt;br /&gt;
 Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
 'The username must be Base64 encoded (and add the CR + LF)!&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;**********************=={013}{010}&amp;quot; ) 'USERNAME&lt;br /&gt;
&lt;br /&gt;
 Do&lt;br /&gt;
 Tcp_var = Tcpread(idx , email_string) ' get response from SMTP server&lt;br /&gt;
 If Left(email_string , 3) = &amp;quot;334&amp;quot; Then&lt;br /&gt;
 print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
 Exit Do&lt;br /&gt;
 End If&lt;br /&gt;
 'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
 Loop&lt;br /&gt;
&lt;br /&gt;
 Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
 'The password must be Base64 encoded (and add the CR + LF) !&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;********************=={013}{010}&amp;quot; ) 'PASSWORD&lt;br /&gt;
&lt;br /&gt;
 Do&lt;br /&gt;
 Tcp_var = Tcpread(idx , email_string) ' get response from SMTP server&lt;br /&gt;
 If Left(email_string , 3) = &amp;quot;235&amp;quot; Then&lt;br /&gt;
 print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
 Exit Do&lt;br /&gt;
 End If&lt;br /&gt;
 'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
 Loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
 'Your Email address&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;MAIL FROM: *********@***.com{013}{010}&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 Do&lt;br /&gt;
 Tcp_var = Tcpread(idx , email_string) ' get response from SMTP server&lt;br /&gt;
 If Left(email_string , 3) = &amp;quot;250&amp;quot; Then&lt;br /&gt;
 print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
 Exit Do&lt;br /&gt;
 End If&lt;br /&gt;
 'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
 Loop&lt;br /&gt;
&lt;br /&gt;
 Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
 'The Email address you want to send the message to&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;RCPT TO: ******@*****.com{013}{010}&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Do&lt;br /&gt;
 Tcp_var = Tcpread(idx , email_string) ' get response from SMTP server&lt;br /&gt;
 If Left(email_string , 3) = &amp;quot;250&amp;quot; Then&lt;br /&gt;
 print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
 Exit Do&lt;br /&gt;
 End If&lt;br /&gt;
 'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
 Loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;DATA{013}{010}&amp;quot; )&lt;br /&gt;
&lt;br /&gt;
 Do&lt;br /&gt;
 Tcp_var = Tcpread(idx , email_string) ' get response from SMTP server&lt;br /&gt;
 If Left(email_string , 3) = &amp;quot;354&amp;quot; Then&lt;br /&gt;
 print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
 Exit Do&lt;br /&gt;
 End If&lt;br /&gt;
 'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
 Loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;FROM: ********@***.de{013}{010}&amp;quot;)&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;TO: *******@****.com{013}{010}&amp;quot;)&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;SUBJECT: Arduino Ethernet Bascom{013}{010}&amp;quot;)&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;X-Mailer: BASCOM SMTP{013}{010}&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 If Send_html = 1 Then&lt;br /&gt;
 '----------------------Send the Email as HTML ---------------------------&lt;br /&gt;
&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;Mime-Version: 1.0;{013}{010}&amp;quot;)&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;Content-Type: text/html; charset={034}ISO-8859-1{034};{013}{010}&amp;quot;)&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;Content-Transfer-Encoding: 7bit;{013}{010}&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;{013}{010}&amp;quot;) 'Empty line to switch to body&lt;br /&gt;
&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;html&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;body&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;h2&amp;gt;The Link to Bascom Forum !&amp;lt;/h2&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;Here is it: &amp;lt;a href={034}http://www.mcselec.com/index2.php?option=com_forum&amp;amp;Itemid=59{034}&amp;gt;Bascom Forum&amp;lt;/a&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;p&amp;gt;Best Regards,&amp;lt;/p&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;p&amp;gt;Arduino Ethernet Bascom&amp;lt;/p&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;/body&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;/html&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;.{013}{010}&amp;quot;)&lt;br /&gt;
 Else&lt;br /&gt;
&lt;br /&gt;
 '-----------------------Send only TEXT-----------------------------------&lt;br /&gt;
&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;{013}{010}&amp;quot;) 'Empty line to switch from subject to body&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;This is a test email from BASCOM-AVR SMTP{013}{010}&amp;quot;)&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;Arduino Ethernet Bascom{013}{010}&amp;quot;)&lt;br /&gt;
 email_string = &amp;quot;Timestamp = &amp;quot; + time$ + &amp;quot; / &amp;quot; + date$ + &amp;quot;{013}{010}&amp;quot;&lt;br /&gt;
 length = len(email_string)&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , email_string, length)&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;.{013}{010}&amp;quot;) ' end with a single dot&lt;br /&gt;
 end if&lt;br /&gt;
&lt;br /&gt;
 Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
 Do&lt;br /&gt;
 Tcp_var = Tcpread(idx , email_string) ' get response from SMTP server&lt;br /&gt;
 If Left(email_string , 3) = &amp;quot;250&amp;quot; Then&lt;br /&gt;
 print &amp;quot;Server Answer = &amp;quot; ; email_string '--&amp;gt; 250 2.6.0 Message accepted&lt;br /&gt;
 Exit Do&lt;br /&gt;
 End If&lt;br /&gt;
 'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
 Loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 print &amp;quot;Send &amp;quot; ; &amp;quot;QUIT{013}{010}&amp;quot;&lt;br /&gt;
 Tcp_var = Tcpwrite(idx , &amp;quot;QUIT{013}{010}&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Do&lt;br /&gt;
 Tcp_var = Tcpread(idx , email_string) ' get response from SMTP server&lt;br /&gt;
 If Left(email_string , 3) = &amp;quot;221&amp;quot; Then&lt;br /&gt;
 print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
 Exit Do&lt;br /&gt;
 End If&lt;br /&gt;
 'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
 Loop&lt;br /&gt;
&lt;br /&gt;
 Print &amp;quot;Close Socket&amp;quot;&lt;br /&gt;
 Closesocket Idx ' close the server connection&lt;br /&gt;
&lt;br /&gt;
End Sub&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
reset watchdog&lt;br /&gt;
&lt;br /&gt;
'Here we send the email&lt;br /&gt;
&lt;br /&gt;
call Send_Email(0) 'Send text Email&lt;br /&gt;
wait 2 : reset watchdog&lt;br /&gt;
call Send_Email(1) 'Send Email in HTML&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Do&lt;br /&gt;
 If New_second = 1 Then&lt;br /&gt;
 Reset New_second&lt;br /&gt;
 reset watchdog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 'Do something every second ......&lt;br /&gt;
&lt;br /&gt;
 print &amp;quot;Tick&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 incr second_counter&lt;br /&gt;
 if second_counter = 180 then&lt;br /&gt;
 second_counter = 0&lt;br /&gt;
 'Do something every 3 minutes ......&lt;br /&gt;
 end if&lt;br /&gt;
 End If&lt;br /&gt;
Loop&lt;br /&gt;
&lt;br /&gt;
End&lt;br /&gt;
&lt;br /&gt;
Timer_irq:&lt;br /&gt;
 Incr Local_time&lt;br /&gt;
 Time$ = Time(local_time)&lt;br /&gt;
 Date$ = Date(local_time)&lt;br /&gt;
 Set New_second&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Getdatetime:&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Settime:&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Setdate:&lt;br /&gt;
Return&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Terminal Ouput of Example&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;-----START Arduino UNO R3 + Ethernet Shield EMAIL DEMO-----&amp;lt;br/&amp;gt;PING NTP Server&amp;amp;nbsp;: 192.53.103.108&amp;lt;br/&amp;gt;Ping Number&amp;amp;nbsp;: 1&amp;lt;br/&amp;gt;PING OK --&amp;gt; Exit Do..Loop&amp;lt;br/&amp;gt;Socket 0 0&amp;lt;br/&amp;gt;Local_time = 416239374&amp;lt;br/&amp;gt;10.03.13&amp;amp;nbsp;&amp;amp;nbsp; 15:02:54&amp;lt;br/&amp;gt;Connecting to GMX Email Server:&amp;amp;nbsp; 213.165.64.21 Port 25&amp;lt;br/&amp;gt;Socketconnect Status = 0&amp;lt;br/&amp;gt;SMTP = SOCK_ESTABLISHED&amp;lt;br/&amp;gt;Server Answer = 220 mail.gmx.net GMX Mailservices ESMTP {mp033}&amp;lt;br/&amp;gt;Send HELO Arduino Ethernet&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;23&amp;amp;nbsp; bytes written&amp;lt;br/&amp;gt;Server Answer = 250 mail.gmx.net GMX Mailservices {mp033}&amp;lt;br/&amp;gt;Send AUTH LOGIN&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;Server Answer = 334 VXNlcm5hbWU6&amp;lt;br/&amp;gt;Server Answer = 334 UGFzc3dvcmQ6&amp;lt;br/&amp;gt;Server Answer = 235 2.7.0 Go ahead {mp033}&amp;lt;br/&amp;gt;Server Answer = 250 2.1.0 ok {mp033}&amp;lt;br/&amp;gt;Server Answer = 250 2.1.5 ok {mp033}&amp;lt;br/&amp;gt;Server Answer = 354 mail.gmx.net Go ahead {mp033}&amp;lt;br/&amp;gt;Server Answer = 250 2.6.0 Message accepted {mp033}&amp;lt;br/&amp;gt;Send QUIT&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;Server Answer = 221 2.0.0 GMX Mailservices {mp033}&amp;lt;br/&amp;gt;Close Socket&amp;lt;br/&amp;gt;Connecting to GMX Email Server:&amp;amp;nbsp; 213.165.64.21 Port 25&amp;lt;br/&amp;gt;Socketconnect Status = 0&amp;lt;br/&amp;gt;SMTP = SOCK_ESTABLISHED&amp;lt;br/&amp;gt;Server Answer = 220 mail.gmx.net GMX Mailservices ESMTP {mp033}&amp;lt;br/&amp;gt;Send HELO Arduino Ethernet&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;23&amp;amp;nbsp; bytes written&amp;lt;br/&amp;gt;Server Answer = 250 mail.gmx.net GMX Mailservices {mp033}&amp;lt;br/&amp;gt;Send AUTH LOGIN&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;Server Answer = 334 VXNlcm5hbWU6&amp;lt;br/&amp;gt;Server Answer = 334 UGFzc3dvcmQ6&amp;lt;br/&amp;gt;Server Answer = 235 2.7.0 Go ahead {mp033}&amp;lt;br/&amp;gt;Server Answer = 250 2.1.0 ok {mp033}&amp;lt;br/&amp;gt;Server Answer = 250 2.1.5 ok {mp033}&amp;lt;br/&amp;gt;Server Answer = 354 mail.gmx.net Go ahead {mp033}&amp;lt;br/&amp;gt;Server Answer = 250 2.6.0 Message accepted {mp033}&amp;lt;br/&amp;gt;Send QUIT&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;Server Answer = 221 2.0.0 GMX Mailservices {mp033}&amp;lt;br/&amp;gt;Close Socket&amp;lt;br/&amp;gt;Tick&amp;lt;br/&amp;gt;Tick&amp;lt;br/&amp;gt;Tick&amp;lt;br/&amp;gt;Tick&amp;lt;br/&amp;gt;Tick&amp;lt;br/&amp;gt;Tick&amp;lt;br/&amp;gt;Tick&amp;lt;br/&amp;gt;Tick&amp;lt;br/&amp;gt;Tick&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Telnet Exercise with sending an Email (if you encounter a problem)&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The AUTH LOGIN smtp command is used to login to the smtp server with Username and password (both must be sent Base64 encoded).&lt;br /&gt;
&lt;br /&gt;
You can use the Easy TCP/IP Tool in Bascom-AVR to decode or encode Base64.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;You can check all the single steps of the SMTP server communication with TELNET in a manual procedure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;1. Enabling Telnet Client in Windows 7&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp; [http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx]&amp;lt;br/&amp;gt;2. Start the DOS command window in Windows 7 and type telnet and return&amp;lt;br/&amp;gt;3. Then you see:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; Microsoft Telnet&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; in the DOS command window.&amp;lt;br/&amp;gt;4. Now type (we use as example GMX with Port 25):&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; open smtp.gmx.net 25&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; (25 is the port number)&amp;lt;br/&amp;gt;5. The answer from the SMTP server will be: &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;220 mail.gmx.net GMX Mailservices ESMTP {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;6. Then type:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; AUTH LOGIN&amp;lt;br/&amp;gt;7. The answer from the SMTP server will be: 334 &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;VXNlcm5hbWU6&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;8. If you decode the&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;VXNlcm5hbWU6&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;/span&amp;gt;for example with the Easy TCP/IP Tool in Bascom-AVR&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; you will notice that the decoded text is &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Username:&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;9. You need now to type in the username Base64 encoded (which is usually your Email address Base64 encoded)&amp;lt;br/&amp;gt;10. After this the SMTP server ask for the password (also Base64 encoded)&amp;lt;br/&amp;gt;11. If you type in the wrong username or password the server's answer is &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;535 5.7.0 Incorrect username or password {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;12. The correct username and password will be answerd by:&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;235 2.7.0 Go ahead {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;13. ...&amp;lt;br/&amp;gt;14. You can start the Email content with DATA and end it with &amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt;.&amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt; '''which is in Bascom {013}{010}.{013}{010}'''&lt;br /&gt;
&lt;br /&gt;
== SMTP Server Reply Codes&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Code Description&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;211 System status, or system help reply.&amp;lt;br/&amp;gt;214 Help message.&amp;lt;br/&amp;gt;220 Domain service ready.Ready to start TLS.&amp;lt;br/&amp;gt;221 Domain service closing transmission channel.&amp;lt;br/&amp;gt;250 Ok , Queuing For Node Node Started.requested Mail Action Okay , Completed.&amp;lt;br/&amp;gt;251 Ok , No Messages Waiting For Node Node.user Not Local , Will Forward To Forwardpath.&amp;lt;br/&amp;gt;252 OK, pending messages for node node started.Cannot VRFY user (e.g., info is not local), but will take message for this user and attempt delivery.&amp;lt;br/&amp;gt;253 OK, messages pending messages for node node started.&amp;lt;br/&amp;gt;354 Start mail input; end with &amp;amp;lt;CRLF&amp;amp;gt;.&amp;amp;lt;CRLF&amp;amp;gt;.&amp;lt;br/&amp;gt;355 Octet-offset is the transaction offset.&amp;lt;br/&amp;gt;421 Domain Service Not Available , Closing Transmission Channel.&amp;lt;br/&amp;gt;432 A password transition is needed.&amp;lt;br/&amp;gt;450 Requested mail action not taken: mailbox unavailable.ATRN request refused.&amp;lt;br/&amp;gt;451 Requested action aborted: local error in processing.Unable to process ATRN request now&amp;lt;br/&amp;gt;452 Requested action not taken: insufficient system storage.&amp;lt;br/&amp;gt;453 You have no mail.&amp;lt;br/&amp;gt;454 TLS not available due to temporary reason.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;458 Unable to queue messages for node node.&amp;lt;br/&amp;gt;459 Node node not allowed: reason.&amp;lt;br/&amp;gt;500 Command not recognized: command.Syntax error.&amp;lt;br/&amp;gt;501 Syntax error, no parameters allowed.&amp;lt;br/&amp;gt;502 Command not implemented.&amp;lt;br/&amp;gt;503 Bad sequence of commands.&amp;lt;br/&amp;gt;504 Command parameter not implemented.&amp;lt;br/&amp;gt;521 Machine does not accept mail.&amp;lt;br/&amp;gt;530 Must issue a STARTTLS command first.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;534 Authentication mechanism is too weak.&amp;lt;br/&amp;gt;538 Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;550 Requested action not taken: mailbox unavailable.&amp;lt;br/&amp;gt;551 User not local; please try forwardpath.&amp;lt;br/&amp;gt;552 Requested mail action aborted: exceeded storage allocation.&amp;lt;br/&amp;gt;553 Requested action not taken: mailbox name not allowed.&amp;lt;br/&amp;gt;554 Transaction failed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Arduino Ethernet with Bascom-AVR]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)</id>
		<title>How to send an Email with Arduino and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-10T14:19:47Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: /* Under Construction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Used Hardware&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
*Arduino UNO R3&lt;br /&gt;
*Ethernet Shield with W5100 Wiznet Chip &amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
== Used Software&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Bascom-AVR 2.0.7.6&lt;br /&gt;
&lt;br /&gt;
Windows7 or 8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== What you need to run the example&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
For the following example you need:&lt;br /&gt;
&lt;br /&gt;
*Email account which support&amp;lt;span dir=&amp;quot;auto&amp;quot;&amp;gt;SMTP Authentication&amp;lt;/span&amp;gt; (AUTH LOGIN) on Port 25&lt;br /&gt;
*Username and password Base64 encoded (you can use the Easy TCP/IP tool in Bascom-AVR to encode and decode)&lt;br /&gt;
*IP address of your smtp server (if you do not know it just open in Windows the DOS command window and ping the server)&lt;br /&gt;
*Your sender Email address and the receiver Email address&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;Don't use the Email Sub in the Do...Loop until you know what you are doing (Your mail provider could ban you if you send too much emails)&amp;amp;nbsp;!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This example use the base structure from here: [http://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100) http://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The focus of this article is Email and not other topics which are already descibed in other articels in this WIKI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You need to change the&amp;amp;nbsp; * (asterisk) !&lt;br /&gt;
&lt;br /&gt;
When you send the Email as HTML (with the Link) it might end up in your spam folder. So check also your spam folder for this email sent in HMTL format !&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
' Send Email with Arduino Ethernet (W5100)&lt;br /&gt;
' Tested with GMX&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'Use Hardware:&lt;br /&gt;
' - Arduino UNO R3&lt;br /&gt;
' - Arduino Ethernet Shield with W5100 Wiznet Chip&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
' NTP Server IP address (here you can change the NTP server of your choice)&lt;br /&gt;
Const Ntp1 = 192 : Const Ntp2 = 53 : Const Ntp3 = 103 : Const Ntp4 = 108       ' Example NTP Server =  192.53.103.108&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Const Use_ping = 1                                         'use PING NTP server for checking NTP server availability before move on&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$regfile = &amp;quot;m328pdef.dat&amp;quot;&lt;br /&gt;
$crystal = 16000000                                         '16MHz&lt;br /&gt;
$hwstack = 100&lt;br /&gt;
$swstack = 100&lt;br /&gt;
$framesize = 400&lt;br /&gt;
&lt;br /&gt;
config submode = new&lt;br /&gt;
&lt;br /&gt;
Config Com1 = 57600 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Watchdog&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
config watchdog = 4096&lt;br /&gt;
Start watchdog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Server Variables&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Ip_sntp_server As Long&lt;br /&gt;
'assign the IP number of a SNTP server&lt;br /&gt;
Ip_sntp_server = Maketcp(ntp1 , Ntp2 , Ntp3 , Ntp4)         'assign IP of NTP SERVER&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Wait 2  'Time to start the Debug Terminal after flashing&lt;br /&gt;
reset watchdog&lt;br /&gt;
Print&lt;br /&gt;
Print &amp;quot;-----START Arduino UNO R3 + Ethernet Shield EMAIL DEMO-----&amp;quot;&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Network Hardware&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = Low , Phase = 0 , Clockrate = 4 , Noss = 0&lt;br /&gt;
Spiinit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Enable Interrupts&lt;br /&gt;
&lt;br /&gt;
  'Here you need MAC address, the ip address you like to use, subnet mask, gateway and localport&lt;br /&gt;
  Config Tcpip = Noint , _&lt;br /&gt;
            Mac = 1.1.94.127.1.255 , _&lt;br /&gt;
            Ip = 192.168.2.254 , _&lt;br /&gt;
            Submask = 255.255.255.0 , _&lt;br /&gt;
            Gateway = 192.168.2.1 , _&lt;br /&gt;
            Localport = 1000 , _&lt;br /&gt;
            Tx = $55 , Rx = $55 , _&lt;br /&gt;
            Chip = W5100 , _&lt;br /&gt;
            Spi = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
'  Config Clock&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Local_time As Long&lt;br /&gt;
Dim New_second As Bit&lt;br /&gt;
dim second_counter as byte&lt;br /&gt;
&lt;br /&gt;
Config Date = Dmy , Separator = .&lt;br /&gt;
Config Clock = User&lt;br /&gt;
&lt;br /&gt;
Config Timer1 = Timer , Prescale = 256&lt;br /&gt;
On Timer1 Timer_irq Saveall                                 'the SAVEALL option is NEEDED !&lt;br /&gt;
Const Timer_preload = 3036&lt;br /&gt;
Enable Timer1&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
'  SMTP Email Variables&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Smtp_sock As Byte&lt;br /&gt;
Dim Tcp_var As Byte&lt;br /&gt;
Dim email_string As String * 130&lt;br /&gt;
Dim length as byte&lt;br /&gt;
&lt;br /&gt;
Const Smtp_email_socket = 1     'Socket Number for SMTP&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
'  UDP Variables&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Idx As Byte                                             ' socket number&lt;br /&gt;
Dim Result As Word                                          ' result&lt;br /&gt;
Dim S(255) As Byte&lt;br /&gt;
Dim R(255) As Byte&lt;br /&gt;
Dim Sstr As String * 255&lt;br /&gt;
Dim Temp As Byte , Temp2 As Byte                            ' temp bytes&lt;br /&gt;
Dim Ip As Long&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
'  PING NTP SERVER to check if NTP server is available&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
#if Use_ping = 1&lt;br /&gt;
   Dim J As Byte , Res As Byte&lt;br /&gt;
   Dim Ii As Byte&lt;br /&gt;
   Dim Ping_check_ok As Bit&lt;br /&gt;
&lt;br /&gt;
   Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
   ' FILL PING ARRAY&lt;br /&gt;
   S(1) = 8                                                    'type is echo&lt;br /&gt;
   S(2) = 0                                                    'code&lt;br /&gt;
&lt;br /&gt;
   S(3) = 0                                                    ' for checksum initialization&lt;br /&gt;
   S(4) = 0                                                    ' checksum&lt;br /&gt;
   S(5) = 0                                                    ' a signature can be any number&lt;br /&gt;
   S(6) = 1                                                    '   signature&lt;br /&gt;
   S(7) = 0                                                    ' sequence number - any number&lt;br /&gt;
   S(8) = 1&lt;br /&gt;
   S(9) = 65&lt;br /&gt;
&lt;br /&gt;
   Dim W As Word At S + 2 Overlay                              'same as dta(3) and dta(4)&lt;br /&gt;
   Dim B As Byte&lt;br /&gt;
   W = Tcpchecksum(s(1) , 9)                                   ' calculate checksum and store in dta(3) and dta(4)&lt;br /&gt;
&lt;br /&gt;
   'Ip = Maketcp(192.53.103.108)                                'try to check this google server&lt;br /&gt;
   Print &amp;quot;PING NTP Server : &amp;quot; ; Ip2str(ip_sntp_server)&lt;br /&gt;
&lt;br /&gt;
   'Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
   Setipprotocol Idx , 1                                       'set protocol to 1&lt;br /&gt;
   'the protocol value must be set BEFORE the socket is openend&lt;br /&gt;
&lt;br /&gt;
   Idx = Getsocket(idx , Sock_ipl_raw , 5000 , 0)              'RAW Socket&lt;br /&gt;
&lt;br /&gt;
   ' We try the PING 3 times (but if we get an answer we exit the for loop)&lt;br /&gt;
   Do&lt;br /&gt;
      Incr Ii&lt;br /&gt;
&lt;br /&gt;
      Result = Udpwrite(ip_sntp_server , 7 , Idx , S(1) , 9)   'write ping data               '&lt;br /&gt;
      Print &amp;quot;Ping Number : &amp;quot; ; ii&lt;br /&gt;
      Waitms 200                                               ' depending on the hops, speed, etc&lt;br /&gt;
      Result = Socketstat(idx , Sel_recv)                      'check for data&lt;br /&gt;
    '  Print &amp;quot;REC:&amp;quot; ; Result&lt;br /&gt;
      If Result &amp;gt;= 11 Then&lt;br /&gt;
&lt;br /&gt;
         Res = Tcpread(idx , R(1) , Result)                    'get data with TCPREAD !!!&lt;br /&gt;
&lt;br /&gt;
      '     Print &amp;quot;DATA RETURNED :&amp;quot; ; Res&lt;br /&gt;
      '(                     '&lt;br /&gt;
           For J = 1 To Result&lt;br /&gt;
             Print R(j) ; &amp;quot; &amp;quot; ;&lt;br /&gt;
           Next&lt;br /&gt;
            Print&lt;br /&gt;
      ')&lt;br /&gt;
            Print &amp;quot;PING OK --&amp;gt; Exit Do..Loop&amp;quot;&lt;br /&gt;
&lt;br /&gt;
            Set Ping_check_ok&lt;br /&gt;
&lt;br /&gt;
           Exit Do                                          ' If we can an answer from NTP Server exit do ... loop&lt;br /&gt;
&lt;br /&gt;
      Else&lt;br /&gt;
         Print &amp;quot;NTP Server not available&amp;quot;&lt;br /&gt;
      End If&lt;br /&gt;
      Waitms 100&lt;br /&gt;
&lt;br /&gt;
   Loop Until Ii = 3&lt;br /&gt;
&lt;br /&gt;
   Ii = 0&lt;br /&gt;
#else&lt;br /&gt;
  Dim Ping_check_ok As Bit&lt;br /&gt;
  Ping_check_ok = 1&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
'  SNTP&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
If Ping_check_ok = 1 Then                                   'When the NTP Serverer responded to PING&lt;br /&gt;
   'we need to get a socket first&lt;br /&gt;
   'note that for UDP we specify sock_dgram&lt;br /&gt;
   Idx = Getsocket(idx , Sock_dgram , 1000 , 0)                ' get socket for UDP mode, specify port&lt;br /&gt;
   Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
&lt;br /&gt;
   Local_time = Sntp(idx , Ip_sntp_server)                     ' get time from SNTP server&lt;br /&gt;
   Print &amp;quot;Local_time = &amp;quot; ; Local_time&lt;br /&gt;
&lt;br /&gt;
   If Local_time &amp;lt; 100 Then                                    'try it again&lt;br /&gt;
      Wait 1&lt;br /&gt;
      Local_time = Sntp(idx , Ip_sntp_server)                  ' get time from SNTP server&lt;br /&gt;
      Print &amp;quot;Second try ; Local_time = &amp;quot; ; Local_time&lt;br /&gt;
   End If&lt;br /&gt;
&lt;br /&gt;
   Local_time = Local_time + 3600                              ' (UTC/GMT) time + 3600&lt;br /&gt;
   Print Date(local_time) ; Spc(3) ; Time(local_time)&lt;br /&gt;
End If&lt;br /&gt;
&lt;br /&gt;
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++&lt;br /&gt;
'  +&lt;br /&gt;
'  + SUB NAME:      Send_Email()&lt;br /&gt;
'  +&lt;br /&gt;
'  + DESCRIPTION:   Send Email&lt;br /&gt;
'  +&lt;br /&gt;
'  +&lt;br /&gt;
'  + RETURN:        None&lt;br /&gt;
'  +&lt;br /&gt;
'  + NOTES:         None&lt;br /&gt;
'  +&lt;br /&gt;
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++&lt;br /&gt;
'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sub Send_Email(byval Send_html As Byte) ' 0 = send Text, 1 = send HTML&lt;br /&gt;
&lt;br /&gt;
       '---------------------[SEND EMAIL SMTP]-----------------------------------------&lt;br /&gt;
    'for SMTP Email first we need a socket&lt;br /&gt;
    idx = Getsocket(smtp_email_socket , Sock_stream , 4086 , 0)&lt;br /&gt;
    If idx = 255 Then print &amp;quot;SMTP Email Getsocket Error&amp;quot;&lt;br /&gt;
'(&lt;br /&gt;
    result = Socketstat(idx , Sel_control)&lt;br /&gt;
&lt;br /&gt;
    Select Case result&lt;br /&gt;
      Case Sock_closed : print &amp;quot;Sock_closedr&amp;quot;&lt;br /&gt;
      Case Sock_arp : print &amp;quot;SOCK_ARP&amp;quot;&lt;br /&gt;
      Case Sock_listen : print &amp;quot;SOCK_LISTEN&amp;quot;&lt;br /&gt;
      Case Sock_synsent : print &amp;quot;SOCK_SYNSENT&amp;quot;&lt;br /&gt;
      Case Sock_synrecv : print &amp;quot;SOCK_SYNRECV&amp;quot;&lt;br /&gt;
      Case Sock_established : print &amp;quot;SOCK_ESTABLISHED&amp;quot;&lt;br /&gt;
      Case Sock_close_wait : print &amp;quot;SOCK_CLOSE_WAIT&amp;quot;&lt;br /&gt;
      Case Sock_last_ack : print &amp;quot;SOCK_LAST_ACK&amp;quot;&lt;br /&gt;
      Case Sock_fin_wait : print &amp;quot;SOCK_FIN_WAIT&amp;quot;&lt;br /&gt;
      Case Sock_closing : print &amp;quot;SOCK_CLOSING&amp;quot;&lt;br /&gt;
      Case Sock_time_wait : print &amp;quot;SOCK_TIME_WAIT&amp;quot;&lt;br /&gt;
      Case Sock_init : print &amp;quot;SOCK_INIT&amp;quot;&lt;br /&gt;
      Case Sock_udp : print &amp;quot;SOCK_UDP&amp;quot;&lt;br /&gt;
      Case Sock_raw : print &amp;quot;SOCK_RAW&amp;quot;&lt;br /&gt;
      Case Sock_macraw : print &amp;quot;SOCK_MACRAW&amp;quot;&lt;br /&gt;
      Case Sock_ppoe : print &amp;quot;SOCK_PPOE&amp;quot;&lt;br /&gt;
    End Select&lt;br /&gt;
')&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    'connect to smtp server&lt;br /&gt;
      result = Socketconnect(idx , 213.165.64.21 , 25)     ' smtp server and SMTP port 25&lt;br /&gt;
      '                        ^socket&lt;br /&gt;
      '                                 ^ ip address of the smtp server&lt;br /&gt;
      '                                               ^ port 25 for smtp&lt;br /&gt;
      print &amp;quot;Connecting to GMX Email Server: &amp;quot; ; &amp;quot; 213.165.64.21 Port 25 &amp;quot;&lt;br /&gt;
&lt;br /&gt;
      print &amp;quot;Socketconnect Status = &amp;quot; ; result&lt;br /&gt;
      If result = 1 Then print &amp;quot;ERROR connecting to 213.165.64.21 Port 25&amp;quot;&lt;br /&gt;
&lt;br /&gt;
      Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
      Do&lt;br /&gt;
            result = Socketstat(idx , 0)       ' get socket status&lt;br /&gt;
      Loop Until result = Sock_established&lt;br /&gt;
&lt;br /&gt;
      print &amp;quot;SMTP = &amp;quot; ; &amp;quot;SOCK_ESTABLISHED&amp;quot;&lt;br /&gt;
&lt;br /&gt;
      Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
       Do&lt;br /&gt;
           Tcp_var = Tcpread(idx , email_string)                 ' get response from SMTP server&lt;br /&gt;
           If Left(email_string , 3) = &amp;quot;220&amp;quot; Then&lt;br /&gt;
             print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
             Exit Do&lt;br /&gt;
           End If&lt;br /&gt;
           'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
       Loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
       print &amp;quot;Send &amp;quot; ; &amp;quot;HELO Arduino Ethernet{013}{010}&amp;quot;&lt;br /&gt;
       Tcp_var = Tcpwrite(idx , &amp;quot;HELO Arduino Ethernet{013}{010}&amp;quot; )       ' send username&lt;br /&gt;
       print Tcp_var ; &amp;quot;  bytes written&amp;quot;               ' number of bytes actual send&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
       Do&lt;br /&gt;
           Tcp_var = Tcpread(idx , email_string)                 ' get response from SMTP server&lt;br /&gt;
&lt;br /&gt;
           If Left(email_string , 3) = &amp;quot;250&amp;quot; Then&lt;br /&gt;
             print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
             Exit Do&lt;br /&gt;
           End If&lt;br /&gt;
           'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
       Loop&lt;br /&gt;
&lt;br /&gt;
       Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
       print &amp;quot;Send &amp;quot; ; &amp;quot;AUTH LOGIN{013}{010}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
       Tcp_var = Tcpwrite(idx , &amp;quot;AUTH LOGIN{013}{010}&amp;quot; )       'authentication login&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
       Do&lt;br /&gt;
           Tcp_var = Tcpread(idx , email_string)                 ' get response from SMTP server&lt;br /&gt;
           If Left(email_string , 3) = &amp;quot;334&amp;quot; Then&lt;br /&gt;
              print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
              Exit Do&lt;br /&gt;
           End If&lt;br /&gt;
           'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
       Loop&lt;br /&gt;
&lt;br /&gt;
       Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
       'The username must be Base64 encoded (and add the CR + LF)!&lt;br /&gt;
       Tcp_var = Tcpwrite(idx , &amp;quot;**********************=={013}{010}&amp;quot; )     'USERNAME&lt;br /&gt;
&lt;br /&gt;
       Do&lt;br /&gt;
           Tcp_var = Tcpread(idx , email_string)                 ' get response from SMTP server&lt;br /&gt;
           If Left(email_string , 3) = &amp;quot;334&amp;quot; Then&lt;br /&gt;
              print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
              Exit Do&lt;br /&gt;
           End If&lt;br /&gt;
           'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
       Loop&lt;br /&gt;
&lt;br /&gt;
       Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
       'The password must be Base64 encoded (and add the CR + LF) !&lt;br /&gt;
       Tcp_var = Tcpwrite(idx , &amp;quot;********************=={013}{010}&amp;quot; )        'PASSWORD&lt;br /&gt;
&lt;br /&gt;
       Do&lt;br /&gt;
           Tcp_var = Tcpread(idx , email_string)                 ' get response from SMTP server&lt;br /&gt;
           If Left(email_string , 3) = &amp;quot;235&amp;quot; Then&lt;br /&gt;
              print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
              Exit Do&lt;br /&gt;
           End If&lt;br /&gt;
           'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
       Loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
       Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
       'Your Email address&lt;br /&gt;
       Tcp_var = Tcpwrite(idx , &amp;quot;MAIL FROM: *********@***.com{013}{010}&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
       Do&lt;br /&gt;
           Tcp_var = Tcpread(idx , email_string)                 ' get response from SMTP server&lt;br /&gt;
           If Left(email_string , 3) = &amp;quot;250&amp;quot; Then&lt;br /&gt;
                print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
                Exit Do&lt;br /&gt;
           End If&lt;br /&gt;
           'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
       Loop&lt;br /&gt;
&lt;br /&gt;
       Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
       'The Email address you want to send the message to&lt;br /&gt;
       Tcp_var = Tcpwrite(idx , &amp;quot;RCPT TO: ******@*****.com{013}{010}&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
       Do&lt;br /&gt;
          Tcp_var = Tcpread(idx , email_string)                  ' get response from SMTP server&lt;br /&gt;
          If Left(email_string , 3) = &amp;quot;250&amp;quot; Then&lt;br /&gt;
               print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
               Exit Do&lt;br /&gt;
          End If&lt;br /&gt;
          'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
       Loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
       Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
       Tcp_var = Tcpwrite(idx , &amp;quot;DATA{013}{010}&amp;quot; )&lt;br /&gt;
&lt;br /&gt;
       Do&lt;br /&gt;
          Tcp_var = Tcpread(idx , email_string)                  ' get response from SMTP server&lt;br /&gt;
               If Left(email_string , 3) = &amp;quot;354&amp;quot; Then&lt;br /&gt;
                  print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
                  Exit Do&lt;br /&gt;
               End If&lt;br /&gt;
               'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
       Loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
       Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
       Tcp_var = Tcpwrite(idx , &amp;quot;FROM: ********@***.de{013}{010}&amp;quot;)&lt;br /&gt;
       Tcp_var = Tcpwrite(idx , &amp;quot;TO: *******@****.com{013}{010}&amp;quot;)&lt;br /&gt;
       Tcp_var = Tcpwrite(idx , &amp;quot;SUBJECT: Arduino Ethernet Bascom{013}{010}&amp;quot;)&lt;br /&gt;
       Tcp_var = Tcpwrite(idx , &amp;quot;X-Mailer: BASCOM SMTP{013}{010}&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
       If Send_html = 1 Then&lt;br /&gt;
          '----------------------Send the Email as HTML ---------------------------&lt;br /&gt;
&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;Mime-Version: 1.0;{013}{010}&amp;quot;)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;Content-Type: text/html; charset={034}ISO-8859-1{034};{013}{010}&amp;quot;)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;Content-Transfer-Encoding: 7bit;{013}{010}&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;{013}{010}&amp;quot;)      'Empty line to switch to body&lt;br /&gt;
&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;html&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;body&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;h2&amp;gt;The Link to Bascom Forum !&amp;lt;/h2&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;Here is it: &amp;lt;a href={034}http://www.mcselec.com/index2.php?option=com_forum&amp;amp;Itemid=59{034}&amp;gt;Bascom Forum&amp;lt;/a&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;p&amp;gt;Best Regards,&amp;lt;/p&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;p&amp;gt;Arduino Ethernet Bascom&amp;lt;/p&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;/body&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;/html&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;.{013}{010}&amp;quot;)&lt;br /&gt;
       Else&lt;br /&gt;
&lt;br /&gt;
             '-----------------------Send only TEXT-----------------------------------&lt;br /&gt;
&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;{013}{010}&amp;quot;)      'Empty line to switch from subject to body&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;This is a test email from BASCOM-AVR SMTP{013}{010}&amp;quot;)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;Arduino Ethernet Bascom{013}{010}&amp;quot;)&lt;br /&gt;
          email_string = &amp;quot;Timestamp = &amp;quot; + time$ + &amp;quot; / &amp;quot; + date$  + &amp;quot;{013}{010}&amp;quot;&lt;br /&gt;
          length = len(email_string)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , email_string, length)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;.{013}{010}&amp;quot;)     ' end with a single dot&lt;br /&gt;
       end if&lt;br /&gt;
&lt;br /&gt;
       Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
       Do&lt;br /&gt;
          Tcp_var = Tcpread(idx , email_string)                  ' get response from SMTP server&lt;br /&gt;
          If Left(email_string , 3) = &amp;quot;250&amp;quot; Then&lt;br /&gt;
                  print &amp;quot;Server Answer = &amp;quot; ; email_string         '--&amp;gt; 250 2.6.0 Message accepted&lt;br /&gt;
                  Exit Do&lt;br /&gt;
           End If&lt;br /&gt;
           'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
       Loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      print &amp;quot;Send &amp;quot; ; &amp;quot;QUIT{013}{010}&amp;quot;&lt;br /&gt;
      Tcp_var = Tcpwrite(idx , &amp;quot;QUIT{013}{010}&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      Do&lt;br /&gt;
         Tcp_var = Tcpread(idx , email_string)                   ' get response from SMTP server&lt;br /&gt;
          If Left(email_string , 3) = &amp;quot;221&amp;quot; Then&lt;br /&gt;
              print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
              Exit Do&lt;br /&gt;
          End If&lt;br /&gt;
          'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
      Loop&lt;br /&gt;
&lt;br /&gt;
      Print &amp;quot;Close Socket&amp;quot;&lt;br /&gt;
      Closesocket Idx                                 ' close the server connection&lt;br /&gt;
&lt;br /&gt;
End Sub&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
reset watchdog&lt;br /&gt;
&lt;br /&gt;
'Here we send the email&lt;br /&gt;
&lt;br /&gt;
call Send_Email(0)       'Send text Email&lt;br /&gt;
wait 2 : reset watchdog&lt;br /&gt;
call Send_Email(1)       'Send Email in HTML&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Do&lt;br /&gt;
    If New_second = 1 Then&lt;br /&gt;
      Reset New_second&lt;br /&gt;
      reset watchdog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      'Do something every second ......&lt;br /&gt;
&lt;br /&gt;
      print &amp;quot;Tick&amp;quot;&lt;br /&gt;
&lt;br /&gt;
      incr second_counter&lt;br /&gt;
      if second_counter = 180 then&lt;br /&gt;
         second_counter = 0&lt;br /&gt;
         'Do something every 3 minutes ......&lt;br /&gt;
      end if&lt;br /&gt;
    End If&lt;br /&gt;
Loop&lt;br /&gt;
&lt;br /&gt;
End&lt;br /&gt;
&lt;br /&gt;
Timer_irq:&lt;br /&gt;
   Incr Local_time&lt;br /&gt;
   Time$ = Time(local_time)&lt;br /&gt;
   Date$ = Date(local_time)&lt;br /&gt;
   Set New_second&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Getdatetime:&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Settime:&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Setdate:&lt;br /&gt;
Return&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Terminal Ouput of Example&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;&amp;lt;br/&amp;gt;-----START Arduino UNO R3 + Ethernet Shield EMAIL DEMO-----&amp;lt;br/&amp;gt;PING NTP Server : 192.53.103.108&amp;lt;br/&amp;gt;Ping Number : 1&amp;lt;br/&amp;gt;PING OK --&amp;gt; Exit Do..Loop&amp;lt;br/&amp;gt;Socket 0 0&amp;lt;br/&amp;gt;Local_time = 416239374&amp;lt;br/&amp;gt;10.03.13&amp;amp;nbsp;&amp;amp;nbsp; 15:02:54&amp;lt;br/&amp;gt;Connecting to GMX Email Server:&amp;amp;nbsp; 213.165.64.21 Port 25&amp;lt;br/&amp;gt;Socketconnect Status = 0&amp;lt;br/&amp;gt;SMTP = SOCK_ESTABLISHED&amp;lt;br/&amp;gt;Server Answer = 220 mail.gmx.net GMX Mailservices ESMTP {mp033}&amp;lt;br/&amp;gt;Send HELO Arduino Ethernet&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;23&amp;amp;nbsp; bytes written&amp;lt;br/&amp;gt;Server Answer = 250 mail.gmx.net GMX Mailservices {mp033}&amp;lt;br/&amp;gt;Send AUTH LOGIN&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;Server Answer = 334 VXNlcm5hbWU6&amp;lt;br/&amp;gt;Server Answer = 334 UGFzc3dvcmQ6&amp;lt;br/&amp;gt;Server Answer = 235 2.7.0 Go ahead {mp033}&amp;lt;br/&amp;gt;Server Answer = 250 2.1.0 ok {mp033}&amp;lt;br/&amp;gt;Server Answer = 250 2.1.5 ok {mp033}&amp;lt;br/&amp;gt;Server Answer = 354 mail.gmx.net Go ahead {mp033}&amp;lt;br/&amp;gt;Server Answer = 250 2.6.0 Message accepted {mp033}&amp;lt;br/&amp;gt;Send QUIT&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;Server Answer = 221 2.0.0 GMX Mailservices {mp033}&amp;lt;br/&amp;gt;Close Socket&amp;lt;br/&amp;gt;Connecting to GMX Email Server:&amp;amp;nbsp; 213.165.64.21 Port 25&amp;lt;br/&amp;gt;Socketconnect Status = 0&amp;lt;br/&amp;gt;SMTP = SOCK_ESTABLISHED&amp;lt;br/&amp;gt;Server Answer = 220 mail.gmx.net GMX Mailservices ESMTP {mp033}&amp;lt;br/&amp;gt;Send HELO Arduino Ethernet&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;23&amp;amp;nbsp; bytes written&amp;lt;br/&amp;gt;Server Answer = 250 mail.gmx.net GMX Mailservices {mp033}&amp;lt;br/&amp;gt;Send AUTH LOGIN&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;Server Answer = 334 VXNlcm5hbWU6&amp;lt;br/&amp;gt;Server Answer = 334 UGFzc3dvcmQ6&amp;lt;br/&amp;gt;Server Answer = 235 2.7.0 Go ahead {mp033}&amp;lt;br/&amp;gt;Server Answer = 250 2.1.0 ok {mp033}&amp;lt;br/&amp;gt;Server Answer = 250 2.1.5 ok {mp033}&amp;lt;br/&amp;gt;Server Answer = 354 mail.gmx.net Go ahead {mp033}&amp;lt;br/&amp;gt;Server Answer = 250 2.6.0 Message accepted {mp033}&amp;lt;br/&amp;gt;Send QUIT&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;Server Answer = 221 2.0.0 GMX Mailservices {mp033}&amp;lt;br/&amp;gt;Close Socket&amp;lt;br/&amp;gt;Tick&amp;lt;br/&amp;gt;Tick&amp;lt;br/&amp;gt;Tick&amp;lt;br/&amp;gt;Tick&amp;lt;br/&amp;gt;Tick&amp;lt;br/&amp;gt;Tick&amp;lt;br/&amp;gt;Tick&amp;lt;br/&amp;gt;Tick&amp;lt;br/&amp;gt;Tick&amp;lt;br/&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Telnet Exercise with sending an Email (if you encounter a problem)&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The AUTH LOGIN smtp command is used to login to the smtp server with Username and password (both must be sent Base64 encoded).&lt;br /&gt;
&lt;br /&gt;
You can use the Easy TCP/IP Tool in Bascom-AVR to decode or encode Base64.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;You can check all the single steps of the SMTP server communication with TELNET in a manual procedure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;1. Enabling Telnet Client in Windows 7&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp; [http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx]&amp;lt;br/&amp;gt;2. Start the DOS command window in Windows 7 and type telnet and return&amp;lt;br/&amp;gt;3. Then you see:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; Microsoft Telnet&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; in the DOS command window.&amp;lt;br/&amp;gt;4. Now type (we use as example GMX with Port 25):&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; open smtp.gmx.net 25&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; (25 is the port number)&amp;lt;br/&amp;gt;5. The answer from the SMTP server will be: &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;220 mail.gmx.net GMX Mailservices ESMTP {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;6. Then type:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; AUTH LOGIN&amp;lt;br/&amp;gt;7. The answer from the SMTP server will be: 334 &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;VXNlcm5hbWU6&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;8. If you decode the&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;VXNlcm5hbWU6&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;/span&amp;gt;for example with the Easy TCP/IP Tool in Bascom-AVR&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; you will notice that the decoded text is &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Username:&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;9. You need now to type in the username Base64 encoded (which is usually your Email address Base64 encoded)&amp;lt;br/&amp;gt;10. After this the SMTP server ask for the password (also Base64 encoded)&amp;lt;br/&amp;gt;11. If you type in the wrong username or password the server's answer is &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;535 5.7.0 Incorrect username or password {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;12. The correct username and password will be answerd by:&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;235 2.7.0 Go ahead {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;13. ...&amp;lt;br/&amp;gt;14. You can start the Email content with DATA and end it with &amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt;.&amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt; '''which is in Bascom {013}{010}.{013}{010}'''&lt;br /&gt;
&lt;br /&gt;
== SMTP Server Reply Codes&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Code Description&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;211 System status, or system help reply.&amp;lt;br/&amp;gt;214 Help message.&amp;lt;br/&amp;gt;220 Domain service ready.Ready to start TLS.&amp;lt;br/&amp;gt;221 Domain service closing transmission channel.&amp;lt;br/&amp;gt;250 Ok , Queuing For Node Node Started.requested Mail Action Okay , Completed.&amp;lt;br/&amp;gt;251 Ok , No Messages Waiting For Node Node.user Not Local , Will Forward To Forwardpath.&amp;lt;br/&amp;gt;252 OK, pending messages for node node started.Cannot VRFY user (e.g., info is not local), but will take message for this user and attempt delivery.&amp;lt;br/&amp;gt;253 OK, messages pending messages for node node started.&amp;lt;br/&amp;gt;354 Start mail input; end with &amp;amp;lt;CRLF&amp;amp;gt;.&amp;amp;lt;CRLF&amp;amp;gt;.&amp;lt;br/&amp;gt;355 Octet-offset is the transaction offset.&amp;lt;br/&amp;gt;421 Domain Service Not Available , Closing Transmission Channel.&amp;lt;br/&amp;gt;432 A password transition is needed.&amp;lt;br/&amp;gt;450 Requested mail action not taken: mailbox unavailable.ATRN request refused.&amp;lt;br/&amp;gt;451 Requested action aborted: local error in processing.Unable to process ATRN request now&amp;lt;br/&amp;gt;452 Requested action not taken: insufficient system storage.&amp;lt;br/&amp;gt;453 You have no mail.&amp;lt;br/&amp;gt;454 TLS not available due to temporary reason.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;458 Unable to queue messages for node node.&amp;lt;br/&amp;gt;459 Node node not allowed: reason.&amp;lt;br/&amp;gt;500 Command not recognized: command.Syntax error.&amp;lt;br/&amp;gt;501 Syntax error, no parameters allowed.&amp;lt;br/&amp;gt;502 Command not implemented.&amp;lt;br/&amp;gt;503 Bad sequence of commands.&amp;lt;br/&amp;gt;504 Command parameter not implemented.&amp;lt;br/&amp;gt;521 Machine does not accept mail.&amp;lt;br/&amp;gt;530 Must issue a STARTTLS command first.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;534 Authentication mechanism is too weak.&amp;lt;br/&amp;gt;538 Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;550 Requested action not taken: mailbox unavailable.&amp;lt;br/&amp;gt;551 User not local; please try forwardpath.&amp;lt;br/&amp;gt;552 Requested mail action aborted: exceeded storage allocation.&amp;lt;br/&amp;gt;553 Requested action not taken: mailbox name not allowed.&amp;lt;br/&amp;gt;554 Transaction failed.&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
......&lt;br /&gt;
&lt;br /&gt;
[[Category:Arduino Ethernet with Bascom-AVR]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)</id>
		<title>How to send an Email with Arduino and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-10T14:15:23Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: /* What you need to run the example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Used Hardware&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
*Arduino UNO R3&lt;br /&gt;
*Ethernet Shield with W5100 Wiznet Chip &amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
== Used Software&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Bascom-AVR 2.0.7.6&lt;br /&gt;
&lt;br /&gt;
Windows7 or 8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== What you need to run the example&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
For the following example you need:&lt;br /&gt;
&lt;br /&gt;
*Email account which support&amp;lt;span dir=&amp;quot;auto&amp;quot;&amp;gt;SMTP Authentication&amp;lt;/span&amp;gt; (AUTH LOGIN) on Port 25&lt;br /&gt;
*Username and password Base64 encoded (you can use the Easy TCP/IP tool in Bascom-AVR to encode and decode)&lt;br /&gt;
*IP address of your smtp server (if you do not know it just open in Windows the DOS command window and ping the server)&lt;br /&gt;
*Your sender Email address and the receiver Email address&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;Don't use the Email Sub in the Do...Loop until you know what you are doing (Your mail provider could ban you if you send too much emails)&amp;amp;nbsp;!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This example use the base structure from here: [http://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100) http://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The focus of this article is Email and not other topics which are already descibed in other articels in this WIKI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You need to change the&amp;amp;nbsp; * (asterisk) !&lt;br /&gt;
&lt;br /&gt;
When you send the Email as HTML (with the Link) it might end up in your spam folder. So check also your spam folder for this email sent in HMTL format !&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
' Send Email with Arduino Ethernet (W5100)&lt;br /&gt;
' Tested with GMX&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'Use Hardware:&lt;br /&gt;
' - Arduino UNO R3&lt;br /&gt;
' - Arduino Ethernet Shield with W5100 Wiznet Chip&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
' NTP Server IP address (here you can change the NTP server of your choice)&lt;br /&gt;
Const Ntp1 = 192 : Const Ntp2 = 53 : Const Ntp3 = 103 : Const Ntp4 = 108       ' Example NTP Server =  192.53.103.108&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Const Use_ping = 1                                         'use PING NTP server for checking NTP server availability before move on&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$regfile = &amp;quot;m328pdef.dat&amp;quot;&lt;br /&gt;
$crystal = 16000000                                         '16MHz&lt;br /&gt;
$hwstack = 100&lt;br /&gt;
$swstack = 100&lt;br /&gt;
$framesize = 400&lt;br /&gt;
&lt;br /&gt;
config submode = new&lt;br /&gt;
&lt;br /&gt;
Config Com1 = 57600 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Watchdog&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
config watchdog = 4096&lt;br /&gt;
Start watchdog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Server Variables&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Ip_sntp_server As Long&lt;br /&gt;
'assign the IP number of a SNTP server&lt;br /&gt;
Ip_sntp_server = Maketcp(ntp1 , Ntp2 , Ntp3 , Ntp4)         'assign IP of NTP SERVER&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Wait 2  'Time to start the Debug Terminal after flashing&lt;br /&gt;
reset watchdog&lt;br /&gt;
Print&lt;br /&gt;
Print &amp;quot;-----START Arduino UNO R3 + Ethernet Shield EMAIL DEMO-----&amp;quot;&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Network Hardware&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = Low , Phase = 0 , Clockrate = 4 , Noss = 0&lt;br /&gt;
Spiinit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Enable Interrupts&lt;br /&gt;
&lt;br /&gt;
  'Here you need MAC address, the ip address you like to use, subnet mask, gateway and localport&lt;br /&gt;
  Config Tcpip = Noint , _&lt;br /&gt;
            Mac = 1.1.94.127.1.255 , _&lt;br /&gt;
            Ip = 192.168.2.254 , _&lt;br /&gt;
            Submask = 255.255.255.0 , _&lt;br /&gt;
            Gateway = 192.168.2.1 , _&lt;br /&gt;
            Localport = 1000 , _&lt;br /&gt;
            Tx = $55 , Rx = $55 , _&lt;br /&gt;
            Chip = W5100 , _&lt;br /&gt;
            Spi = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
'  Config Clock&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Local_time As Long&lt;br /&gt;
Dim New_second As Bit&lt;br /&gt;
dim second_counter as byte&lt;br /&gt;
&lt;br /&gt;
Config Date = Dmy , Separator = .&lt;br /&gt;
Config Clock = User&lt;br /&gt;
&lt;br /&gt;
Config Timer1 = Timer , Prescale = 256&lt;br /&gt;
On Timer1 Timer_irq Saveall                                 'the SAVEALL option is NEEDED !&lt;br /&gt;
Const Timer_preload = 3036&lt;br /&gt;
Enable Timer1&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
'  SMTP Email Variables&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Smtp_sock As Byte&lt;br /&gt;
Dim Tcp_var As Byte&lt;br /&gt;
Dim email_string As String * 130&lt;br /&gt;
Dim length as byte&lt;br /&gt;
&lt;br /&gt;
Const Smtp_email_socket = 1     'Socket Number for SMTP&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
'  UDP Variables&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Idx As Byte                                             ' socket number&lt;br /&gt;
Dim Result As Word                                          ' result&lt;br /&gt;
Dim S(255) As Byte&lt;br /&gt;
Dim R(255) As Byte&lt;br /&gt;
Dim Sstr As String * 255&lt;br /&gt;
Dim Temp As Byte , Temp2 As Byte                            ' temp bytes&lt;br /&gt;
Dim Ip As Long&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
'  PING NTP SERVER to check if NTP server is available&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
#if Use_ping = 1&lt;br /&gt;
   Dim J As Byte , Res As Byte&lt;br /&gt;
   Dim Ii As Byte&lt;br /&gt;
   Dim Ping_check_ok As Bit&lt;br /&gt;
&lt;br /&gt;
   Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
   ' FILL PING ARRAY&lt;br /&gt;
   S(1) = 8                                                    'type is echo&lt;br /&gt;
   S(2) = 0                                                    'code&lt;br /&gt;
&lt;br /&gt;
   S(3) = 0                                                    ' for checksum initialization&lt;br /&gt;
   S(4) = 0                                                    ' checksum&lt;br /&gt;
   S(5) = 0                                                    ' a signature can be any number&lt;br /&gt;
   S(6) = 1                                                    '   signature&lt;br /&gt;
   S(7) = 0                                                    ' sequence number - any number&lt;br /&gt;
   S(8) = 1&lt;br /&gt;
   S(9) = 65&lt;br /&gt;
&lt;br /&gt;
   Dim W As Word At S + 2 Overlay                              'same as dta(3) and dta(4)&lt;br /&gt;
   Dim B As Byte&lt;br /&gt;
   W = Tcpchecksum(s(1) , 9)                                   ' calculate checksum and store in dta(3) and dta(4)&lt;br /&gt;
&lt;br /&gt;
   'Ip = Maketcp(192.53.103.108)                                'try to check this google server&lt;br /&gt;
   Print &amp;quot;PING NTP Server : &amp;quot; ; Ip2str(ip_sntp_server)&lt;br /&gt;
&lt;br /&gt;
   'Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
   Setipprotocol Idx , 1                                       'set protocol to 1&lt;br /&gt;
   'the protocol value must be set BEFORE the socket is openend&lt;br /&gt;
&lt;br /&gt;
   Idx = Getsocket(idx , Sock_ipl_raw , 5000 , 0)              'RAW Socket&lt;br /&gt;
&lt;br /&gt;
   ' We try the PING 3 times (but if we get an answer we exit the for loop)&lt;br /&gt;
   Do&lt;br /&gt;
      Incr Ii&lt;br /&gt;
&lt;br /&gt;
      Result = Udpwrite(ip_sntp_server , 7 , Idx , S(1) , 9)   'write ping data               '&lt;br /&gt;
      Print &amp;quot;Ping Number : &amp;quot; ; ii&lt;br /&gt;
      Waitms 200                                               ' depending on the hops, speed, etc&lt;br /&gt;
      Result = Socketstat(idx , Sel_recv)                      'check for data&lt;br /&gt;
    '  Print &amp;quot;REC:&amp;quot; ; Result&lt;br /&gt;
      If Result &amp;gt;= 11 Then&lt;br /&gt;
&lt;br /&gt;
         Res = Tcpread(idx , R(1) , Result)                    'get data with TCPREAD !!!&lt;br /&gt;
&lt;br /&gt;
      '     Print &amp;quot;DATA RETURNED :&amp;quot; ; Res&lt;br /&gt;
      '(                     '&lt;br /&gt;
           For J = 1 To Result&lt;br /&gt;
             Print R(j) ; &amp;quot; &amp;quot; ;&lt;br /&gt;
           Next&lt;br /&gt;
            Print&lt;br /&gt;
      ')&lt;br /&gt;
            Print &amp;quot;PING OK --&amp;gt; Exit Do..Loop&amp;quot;&lt;br /&gt;
&lt;br /&gt;
            Set Ping_check_ok&lt;br /&gt;
&lt;br /&gt;
           Exit Do                                          ' If we can an answer from NTP Server exit do ... loop&lt;br /&gt;
&lt;br /&gt;
      Else&lt;br /&gt;
         Print &amp;quot;NTP Server not available&amp;quot;&lt;br /&gt;
      End If&lt;br /&gt;
      Waitms 100&lt;br /&gt;
&lt;br /&gt;
   Loop Until Ii = 3&lt;br /&gt;
&lt;br /&gt;
   Ii = 0&lt;br /&gt;
#else&lt;br /&gt;
  Dim Ping_check_ok As Bit&lt;br /&gt;
  Ping_check_ok = 1&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
'  SNTP&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
If Ping_check_ok = 1 Then                                   'When the NTP Serverer responded to PING&lt;br /&gt;
   'we need to get a socket first&lt;br /&gt;
   'note that for UDP we specify sock_dgram&lt;br /&gt;
   Idx = Getsocket(idx , Sock_dgram , 1000 , 0)                ' get socket for UDP mode, specify port&lt;br /&gt;
   Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
&lt;br /&gt;
   Local_time = Sntp(idx , Ip_sntp_server)                     ' get time from SNTP server&lt;br /&gt;
   Print &amp;quot;Local_time = &amp;quot; ; Local_time&lt;br /&gt;
&lt;br /&gt;
   If Local_time &amp;lt; 100 Then                                    'try it again&lt;br /&gt;
      Wait 1&lt;br /&gt;
      Local_time = Sntp(idx , Ip_sntp_server)                  ' get time from SNTP server&lt;br /&gt;
      Print &amp;quot;Second try ; Local_time = &amp;quot; ; Local_time&lt;br /&gt;
   End If&lt;br /&gt;
&lt;br /&gt;
   Local_time = Local_time + 3600                              ' (UTC/GMT) time + 3600&lt;br /&gt;
   Print Date(local_time) ; Spc(3) ; Time(local_time)&lt;br /&gt;
End If&lt;br /&gt;
&lt;br /&gt;
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++&lt;br /&gt;
'  +&lt;br /&gt;
'  + SUB NAME:      Send_Email()&lt;br /&gt;
'  +&lt;br /&gt;
'  + DESCRIPTION:   Send Email&lt;br /&gt;
'  +&lt;br /&gt;
'  +&lt;br /&gt;
'  + RETURN:        None&lt;br /&gt;
'  +&lt;br /&gt;
'  + NOTES:         None&lt;br /&gt;
'  +&lt;br /&gt;
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++&lt;br /&gt;
'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sub Send_Email(byval Send_html As Byte) ' 0 = send Text, 1 = send HTML&lt;br /&gt;
&lt;br /&gt;
       '---------------------[SEND EMAIL SMTP]-----------------------------------------&lt;br /&gt;
    'for SMTP Email first we need a socket&lt;br /&gt;
    idx = Getsocket(smtp_email_socket , Sock_stream , 4086 , 0)&lt;br /&gt;
    If idx = 255 Then print &amp;quot;SMTP Email Getsocket Error&amp;quot;&lt;br /&gt;
'(&lt;br /&gt;
    result = Socketstat(idx , Sel_control)&lt;br /&gt;
&lt;br /&gt;
    Select Case result&lt;br /&gt;
      Case Sock_closed : print &amp;quot;Sock_closedr&amp;quot;&lt;br /&gt;
      Case Sock_arp : print &amp;quot;SOCK_ARP&amp;quot;&lt;br /&gt;
      Case Sock_listen : print &amp;quot;SOCK_LISTEN&amp;quot;&lt;br /&gt;
      Case Sock_synsent : print &amp;quot;SOCK_SYNSENT&amp;quot;&lt;br /&gt;
      Case Sock_synrecv : print &amp;quot;SOCK_SYNRECV&amp;quot;&lt;br /&gt;
      Case Sock_established : print &amp;quot;SOCK_ESTABLISHED&amp;quot;&lt;br /&gt;
      Case Sock_close_wait : print &amp;quot;SOCK_CLOSE_WAIT&amp;quot;&lt;br /&gt;
      Case Sock_last_ack : print &amp;quot;SOCK_LAST_ACK&amp;quot;&lt;br /&gt;
      Case Sock_fin_wait : print &amp;quot;SOCK_FIN_WAIT&amp;quot;&lt;br /&gt;
      Case Sock_closing : print &amp;quot;SOCK_CLOSING&amp;quot;&lt;br /&gt;
      Case Sock_time_wait : print &amp;quot;SOCK_TIME_WAIT&amp;quot;&lt;br /&gt;
      Case Sock_init : print &amp;quot;SOCK_INIT&amp;quot;&lt;br /&gt;
      Case Sock_udp : print &amp;quot;SOCK_UDP&amp;quot;&lt;br /&gt;
      Case Sock_raw : print &amp;quot;SOCK_RAW&amp;quot;&lt;br /&gt;
      Case Sock_macraw : print &amp;quot;SOCK_MACRAW&amp;quot;&lt;br /&gt;
      Case Sock_ppoe : print &amp;quot;SOCK_PPOE&amp;quot;&lt;br /&gt;
    End Select&lt;br /&gt;
')&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    'connect to smtp server&lt;br /&gt;
      result = Socketconnect(idx , 213.165.64.21 , 25)     ' smtp server and SMTP port 25&lt;br /&gt;
      '                        ^socket&lt;br /&gt;
      '                                 ^ ip address of the smtp server&lt;br /&gt;
      '                                               ^ port 25 for smtp&lt;br /&gt;
      print &amp;quot;Connecting to GMX Email Server: &amp;quot; ; &amp;quot; 213.165.64.21 Port 25 &amp;quot;&lt;br /&gt;
&lt;br /&gt;
      print &amp;quot;Socketconnect Status = &amp;quot; ; result&lt;br /&gt;
      If result = 1 Then print &amp;quot;ERROR connecting to 213.165.64.21 Port 25&amp;quot;&lt;br /&gt;
&lt;br /&gt;
      Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
      Do&lt;br /&gt;
            result = Socketstat(idx , 0)       ' get socket status&lt;br /&gt;
      Loop Until result = Sock_established&lt;br /&gt;
&lt;br /&gt;
      print &amp;quot;SMTP = &amp;quot; ; &amp;quot;SOCK_ESTABLISHED&amp;quot;&lt;br /&gt;
&lt;br /&gt;
      Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
       Do&lt;br /&gt;
           Tcp_var = Tcpread(idx , email_string)                 ' get response from SMTP server&lt;br /&gt;
           If Left(email_string , 3) = &amp;quot;220&amp;quot; Then&lt;br /&gt;
             print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
             Exit Do&lt;br /&gt;
           End If&lt;br /&gt;
           'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
       Loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
       print &amp;quot;Send &amp;quot; ; &amp;quot;HELO Arduino Ethernet{013}{010}&amp;quot;&lt;br /&gt;
       Tcp_var = Tcpwrite(idx , &amp;quot;HELO Arduino Ethernet{013}{010}&amp;quot; )       ' send username&lt;br /&gt;
       print Tcp_var ; &amp;quot;  bytes written&amp;quot;               ' number of bytes actual send&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
       Do&lt;br /&gt;
           Tcp_var = Tcpread(idx , email_string)                 ' get response from SMTP server&lt;br /&gt;
&lt;br /&gt;
           If Left(email_string , 3) = &amp;quot;250&amp;quot; Then&lt;br /&gt;
             print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
             Exit Do&lt;br /&gt;
           End If&lt;br /&gt;
           'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
       Loop&lt;br /&gt;
&lt;br /&gt;
       Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
       print &amp;quot;Send &amp;quot; ; &amp;quot;AUTH LOGIN{013}{010}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
       Tcp_var = Tcpwrite(idx , &amp;quot;AUTH LOGIN{013}{010}&amp;quot; )       'authentication login&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
       Do&lt;br /&gt;
           Tcp_var = Tcpread(idx , email_string)                 ' get response from SMTP server&lt;br /&gt;
           If Left(email_string , 3) = &amp;quot;334&amp;quot; Then&lt;br /&gt;
              print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
              Exit Do&lt;br /&gt;
           End If&lt;br /&gt;
           'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
       Loop&lt;br /&gt;
&lt;br /&gt;
       Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
       'The username must be Base64 encoded (and add the CR + LF)!&lt;br /&gt;
       Tcp_var = Tcpwrite(idx , &amp;quot;**********************=={013}{010}&amp;quot; )     'USERNAME&lt;br /&gt;
&lt;br /&gt;
       Do&lt;br /&gt;
           Tcp_var = Tcpread(idx , email_string)                 ' get response from SMTP server&lt;br /&gt;
           If Left(email_string , 3) = &amp;quot;334&amp;quot; Then&lt;br /&gt;
              print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
              Exit Do&lt;br /&gt;
           End If&lt;br /&gt;
           'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
       Loop&lt;br /&gt;
&lt;br /&gt;
       Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
       'The password must be Base64 encoded (and add the CR + LF) !&lt;br /&gt;
       Tcp_var = Tcpwrite(idx , &amp;quot;********************=={013}{010}&amp;quot; )        'PASSWORD&lt;br /&gt;
&lt;br /&gt;
       Do&lt;br /&gt;
           Tcp_var = Tcpread(idx , email_string)                 ' get response from SMTP server&lt;br /&gt;
           If Left(email_string , 3) = &amp;quot;235&amp;quot; Then&lt;br /&gt;
              print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
              Exit Do&lt;br /&gt;
           End If&lt;br /&gt;
           'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
       Loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
       Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
       'Your Email address&lt;br /&gt;
       Tcp_var = Tcpwrite(idx , &amp;quot;MAIL FROM: *********@***.com{013}{010}&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
       Do&lt;br /&gt;
           Tcp_var = Tcpread(idx , email_string)                 ' get response from SMTP server&lt;br /&gt;
           If Left(email_string , 3) = &amp;quot;250&amp;quot; Then&lt;br /&gt;
                print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
                Exit Do&lt;br /&gt;
           End If&lt;br /&gt;
           'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
       Loop&lt;br /&gt;
&lt;br /&gt;
       Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
       'The Email address you want to send the message to&lt;br /&gt;
       Tcp_var = Tcpwrite(idx , &amp;quot;RCPT TO: ******@*****.com{013}{010}&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
       Do&lt;br /&gt;
          Tcp_var = Tcpread(idx , email_string)                  ' get response from SMTP server&lt;br /&gt;
          If Left(email_string , 3) = &amp;quot;250&amp;quot; Then&lt;br /&gt;
               print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
               Exit Do&lt;br /&gt;
          End If&lt;br /&gt;
          'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
       Loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
       Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
       Tcp_var = Tcpwrite(idx , &amp;quot;DATA{013}{010}&amp;quot; )&lt;br /&gt;
&lt;br /&gt;
       Do&lt;br /&gt;
          Tcp_var = Tcpread(idx , email_string)                  ' get response from SMTP server&lt;br /&gt;
               If Left(email_string , 3) = &amp;quot;354&amp;quot; Then&lt;br /&gt;
                  print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
                  Exit Do&lt;br /&gt;
               End If&lt;br /&gt;
               'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
       Loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
       Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
       Tcp_var = Tcpwrite(idx , &amp;quot;FROM: ********@***.de{013}{010}&amp;quot;)&lt;br /&gt;
       Tcp_var = Tcpwrite(idx , &amp;quot;TO: *******@****.com{013}{010}&amp;quot;)&lt;br /&gt;
       Tcp_var = Tcpwrite(idx , &amp;quot;SUBJECT: Arduino Ethernet Bascom{013}{010}&amp;quot;)&lt;br /&gt;
       Tcp_var = Tcpwrite(idx , &amp;quot;X-Mailer: BASCOM SMTP{013}{010}&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
       If Send_html = 1 Then&lt;br /&gt;
          '----------------------Send the Email as HTML ---------------------------&lt;br /&gt;
&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;Mime-Version: 1.0;{013}{010}&amp;quot;)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;Content-Type: text/html; charset={034}ISO-8859-1{034};{013}{010}&amp;quot;)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;Content-Transfer-Encoding: 7bit;{013}{010}&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;{013}{010}&amp;quot;)      'Empty line to switch to body&lt;br /&gt;
&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;html&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;body&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;h2&amp;gt;The Link to Bascom Forum !&amp;lt;/h2&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;Here is it: &amp;lt;a href={034}http://www.mcselec.com/index2.php?option=com_forum&amp;amp;Itemid=59{034}&amp;gt;Bascom Forum&amp;lt;/a&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;p&amp;gt;Best Regards,&amp;lt;/p&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;p&amp;gt;Arduino Ethernet Bascom&amp;lt;/p&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;/body&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;/html&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;.{013}{010}&amp;quot;)&lt;br /&gt;
       Else&lt;br /&gt;
&lt;br /&gt;
             '-----------------------Send only TEXT-----------------------------------&lt;br /&gt;
&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;{013}{010}&amp;quot;)      'Empty line to switch from subject to body&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;This is a test email from BASCOM-AVR SMTP{013}{010}&amp;quot;)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;Arduino Ethernet Bascom{013}{010}&amp;quot;)&lt;br /&gt;
          email_string = &amp;quot;Timestamp = &amp;quot; + time$ + &amp;quot; / &amp;quot; + date$  + &amp;quot;{013}{010}&amp;quot;&lt;br /&gt;
          length = len(email_string)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , email_string, length)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;.{013}{010}&amp;quot;)     ' end with a single dot&lt;br /&gt;
       end if&lt;br /&gt;
&lt;br /&gt;
       Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
       Do&lt;br /&gt;
          Tcp_var = Tcpread(idx , email_string)                  ' get response from SMTP server&lt;br /&gt;
          If Left(email_string , 3) = &amp;quot;250&amp;quot; Then&lt;br /&gt;
                  print &amp;quot;Server Answer = &amp;quot; ; email_string         '--&amp;gt; 250 2.6.0 Message accepted&lt;br /&gt;
                  Exit Do&lt;br /&gt;
           End If&lt;br /&gt;
           'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
       Loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      print &amp;quot;Send &amp;quot; ; &amp;quot;QUIT{013}{010}&amp;quot;&lt;br /&gt;
      Tcp_var = Tcpwrite(idx , &amp;quot;QUIT{013}{010}&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      Do&lt;br /&gt;
         Tcp_var = Tcpread(idx , email_string)                   ' get response from SMTP server&lt;br /&gt;
          If Left(email_string , 3) = &amp;quot;221&amp;quot; Then&lt;br /&gt;
              print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
              Exit Do&lt;br /&gt;
          End If&lt;br /&gt;
          'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
      Loop&lt;br /&gt;
&lt;br /&gt;
      Print &amp;quot;Close Socket&amp;quot;&lt;br /&gt;
      Closesocket Idx                                 ' close the server connection&lt;br /&gt;
&lt;br /&gt;
End Sub&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
reset watchdog&lt;br /&gt;
&lt;br /&gt;
'Here we send the email&lt;br /&gt;
&lt;br /&gt;
call Send_Email(0)       'Send text Email&lt;br /&gt;
wait 2 : reset watchdog&lt;br /&gt;
call Send_Email(1)       'Send Email in HTML&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Do&lt;br /&gt;
    If New_second = 1 Then&lt;br /&gt;
      Reset New_second&lt;br /&gt;
      reset watchdog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      'Do something every second ......&lt;br /&gt;
&lt;br /&gt;
      print &amp;quot;Tick&amp;quot;&lt;br /&gt;
&lt;br /&gt;
      incr second_counter&lt;br /&gt;
      if second_counter = 180 then&lt;br /&gt;
         second_counter = 0&lt;br /&gt;
         'Do something every 3 minutes ......&lt;br /&gt;
      end if&lt;br /&gt;
    End If&lt;br /&gt;
Loop&lt;br /&gt;
&lt;br /&gt;
End&lt;br /&gt;
&lt;br /&gt;
Timer_irq:&lt;br /&gt;
   Incr Local_time&lt;br /&gt;
   Time$ = Time(local_time)&lt;br /&gt;
   Date$ = Date(local_time)&lt;br /&gt;
   Set New_second&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Getdatetime:&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Settime:&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Setdate:&lt;br /&gt;
Return&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
.....&lt;br /&gt;
&lt;br /&gt;
== Telnet Exercise with sending an Email (if you encounter a problem)&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The AUTH LOGIN smtp command is used to login to the smtp server with Username and password (both must be sent Base64 encoded).&lt;br /&gt;
&lt;br /&gt;
You can use the Easy TCP/IP Tool in Bascom-AVR to decode or encode Base64.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;You can check all the single steps of the SMTP server communication with TELNET in a manual procedure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;1. Enabling Telnet Client in Windows 7&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp; [http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx]&amp;lt;br/&amp;gt;2. Start the DOS command window in Windows 7 and type telnet and return&amp;lt;br/&amp;gt;3. Then you see:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; Microsoft Telnet&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; in the DOS command window.&amp;lt;br/&amp;gt;4. Now type (we use as example GMX with Port 25):&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; open smtp.gmx.net 25&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; (25 is the port number)&amp;lt;br/&amp;gt;5. The answer from the SMTP server will be: &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;220 mail.gmx.net GMX Mailservices ESMTP {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;6. Then type:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; AUTH LOGIN&amp;lt;br/&amp;gt;7. The answer from the SMTP server will be: 334 &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;VXNlcm5hbWU6&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;8. If you decode the&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;VXNlcm5hbWU6&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;/span&amp;gt;for example with the Easy TCP/IP Tool in Bascom-AVR&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; you will notice that the decoded text is &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Username:&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;9. You need now to type in the username Base64 encoded (which is usually your Email address Base64 encoded)&amp;lt;br/&amp;gt;10. After this the SMTP server ask for the password (also Base64 encoded)&amp;lt;br/&amp;gt;11. If you type in the wrong username or password the server's answer is &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;535 5.7.0 Incorrect username or password {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;12. The correct username and password will be answerd by:&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;235 2.7.0 Go ahead {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;13. ...&amp;lt;br/&amp;gt;14. You can start the Email content with DATA and end it with &amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt;.&amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt; '''which is in Bascom {013}{010}.{013}{010}'''&lt;br /&gt;
&lt;br /&gt;
== SMTP Server Reply Codes&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Code Description&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;211 System status, or system help reply.&amp;lt;br/&amp;gt;214 Help message.&amp;lt;br/&amp;gt;220 Domain service ready.Ready to start TLS.&amp;lt;br/&amp;gt;221 Domain service closing transmission channel.&amp;lt;br/&amp;gt;250 Ok , Queuing For Node Node Started.requested Mail Action Okay , Completed.&amp;lt;br/&amp;gt;251 Ok , No Messages Waiting For Node Node.user Not Local , Will Forward To Forwardpath.&amp;lt;br/&amp;gt;252 OK, pending messages for node node started.Cannot VRFY user (e.g., info is not local), but will take message for this user and attempt delivery.&amp;lt;br/&amp;gt;253 OK, messages pending messages for node node started.&amp;lt;br/&amp;gt;354 Start mail input; end with &amp;amp;lt;CRLF&amp;amp;gt;.&amp;amp;lt;CRLF&amp;amp;gt;.&amp;lt;br/&amp;gt;355 Octet-offset is the transaction offset.&amp;lt;br/&amp;gt;421 Domain Service Not Available , Closing Transmission Channel.&amp;lt;br/&amp;gt;432 A password transition is needed.&amp;lt;br/&amp;gt;450 Requested mail action not taken: mailbox unavailable.ATRN request refused.&amp;lt;br/&amp;gt;451 Requested action aborted: local error in processing.Unable to process ATRN request now&amp;lt;br/&amp;gt;452 Requested action not taken: insufficient system storage.&amp;lt;br/&amp;gt;453 You have no mail.&amp;lt;br/&amp;gt;454 TLS not available due to temporary reason.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;458 Unable to queue messages for node node.&amp;lt;br/&amp;gt;459 Node node not allowed: reason.&amp;lt;br/&amp;gt;500 Command not recognized: command.Syntax error.&amp;lt;br/&amp;gt;501 Syntax error, no parameters allowed.&amp;lt;br/&amp;gt;502 Command not implemented.&amp;lt;br/&amp;gt;503 Bad sequence of commands.&amp;lt;br/&amp;gt;504 Command parameter not implemented.&amp;lt;br/&amp;gt;521 Machine does not accept mail.&amp;lt;br/&amp;gt;530 Must issue a STARTTLS command first.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;534 Authentication mechanism is too weak.&amp;lt;br/&amp;gt;538 Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;550 Requested action not taken: mailbox unavailable.&amp;lt;br/&amp;gt;551 User not local; please try forwardpath.&amp;lt;br/&amp;gt;552 Requested mail action aborted: exceeded storage allocation.&amp;lt;br/&amp;gt;553 Requested action not taken: mailbox name not allowed.&amp;lt;br/&amp;gt;554 Transaction failed.&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
......&lt;br /&gt;
&lt;br /&gt;
[[Category:Arduino Ethernet with Bascom-AVR]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)</id>
		<title>How to send an Email with Arduino and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-10T14:11:28Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Used Hardware&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
*Arduino UNO R3&lt;br /&gt;
*Ethernet Shield with W5100 Wiznet Chip &amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
== Used Software&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Bascom-AVR 2.0.7.6&lt;br /&gt;
&lt;br /&gt;
Windows7 or 8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== What you need to run the example&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
For the following example you need:&lt;br /&gt;
&lt;br /&gt;
*Email account which support&amp;lt;span dir=&amp;quot;auto&amp;quot;&amp;gt;SMTP Authentication&amp;lt;/span&amp;gt; (AUTH LOGIN) on Port 25&lt;br /&gt;
*Username and password Base64 encoded (you can use the Easy TCP/IP tool in Bascom-AVR to encode and decode)&lt;br /&gt;
*IP address of your smtp server (if you do not know it just open in Windows the DOS command window and ping the server)&lt;br /&gt;
*Your sender Email address and the receiver Email address&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;Don't use the Email Sub in the Do...Loop until you know what you are doing (Your mail provider could ban you if you send too much emails)&amp;amp;nbsp;!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This example use the base structure from here: [http://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100) http://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The focus of this article is Email and not other topics which are already descibed in other articels in this WIKI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You need to change the&amp;amp;nbsp; * (asterisk) !&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
' Send Email with Arduino Ethernet (W5100)&lt;br /&gt;
' Tested with GMX&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'Use Hardware:&lt;br /&gt;
' - Arduino UNO R3&lt;br /&gt;
' - Arduino Ethernet Shield with W5100 Wiznet Chip&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
' NTP Server IP address (here you can change the NTP server of your choice)&lt;br /&gt;
Const Ntp1 = 192 : Const Ntp2 = 53 : Const Ntp3 = 103 : Const Ntp4 = 108       ' Example NTP Server =  192.53.103.108&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Const Use_ping = 1                                         'use PING NTP server for checking NTP server availability before move on&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$regfile = &amp;quot;m328pdef.dat&amp;quot;&lt;br /&gt;
$crystal = 16000000                                         '16MHz&lt;br /&gt;
$hwstack = 100&lt;br /&gt;
$swstack = 100&lt;br /&gt;
$framesize = 400&lt;br /&gt;
&lt;br /&gt;
config submode = new&lt;br /&gt;
&lt;br /&gt;
Config Com1 = 57600 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Watchdog&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
config watchdog = 4096&lt;br /&gt;
Start watchdog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Server Variables&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Ip_sntp_server As Long&lt;br /&gt;
'assign the IP number of a SNTP server&lt;br /&gt;
Ip_sntp_server = Maketcp(ntp1 , Ntp2 , Ntp3 , Ntp4)         'assign IP of NTP SERVER&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Wait 2  'Time to start the Debug Terminal after flashing&lt;br /&gt;
reset watchdog&lt;br /&gt;
Print&lt;br /&gt;
Print &amp;quot;-----START Arduino UNO R3 + Ethernet Shield EMAIL DEMO-----&amp;quot;&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Network Hardware&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = Low , Phase = 0 , Clockrate = 4 , Noss = 0&lt;br /&gt;
Spiinit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Enable Interrupts&lt;br /&gt;
&lt;br /&gt;
  'Here you need MAC address, the ip address you like to use, subnet mask, gateway and localport&lt;br /&gt;
  Config Tcpip = Noint , _&lt;br /&gt;
            Mac = 1.1.94.127.1.255 , _&lt;br /&gt;
            Ip = 192.168.2.254 , _&lt;br /&gt;
            Submask = 255.255.255.0 , _&lt;br /&gt;
            Gateway = 192.168.2.1 , _&lt;br /&gt;
            Localport = 1000 , _&lt;br /&gt;
            Tx = $55 , Rx = $55 , _&lt;br /&gt;
            Chip = W5100 , _&lt;br /&gt;
            Spi = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
'  Config Clock&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Local_time As Long&lt;br /&gt;
Dim New_second As Bit&lt;br /&gt;
dim second_counter as byte&lt;br /&gt;
&lt;br /&gt;
Config Date = Dmy , Separator = .&lt;br /&gt;
Config Clock = User&lt;br /&gt;
&lt;br /&gt;
Config Timer1 = Timer , Prescale = 256&lt;br /&gt;
On Timer1 Timer_irq Saveall                                 'the SAVEALL option is NEEDED !&lt;br /&gt;
Const Timer_preload = 3036&lt;br /&gt;
Enable Timer1&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
'  SMTP Email Variables&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Smtp_sock As Byte&lt;br /&gt;
Dim Tcp_var As Byte&lt;br /&gt;
Dim email_string As String * 130&lt;br /&gt;
Dim length as byte&lt;br /&gt;
&lt;br /&gt;
Const Smtp_email_socket = 1     'Socket Number for SMTP&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
'  UDP Variables&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Idx As Byte                                             ' socket number&lt;br /&gt;
Dim Result As Word                                          ' result&lt;br /&gt;
Dim S(255) As Byte&lt;br /&gt;
Dim R(255) As Byte&lt;br /&gt;
Dim Sstr As String * 255&lt;br /&gt;
Dim Temp As Byte , Temp2 As Byte                            ' temp bytes&lt;br /&gt;
Dim Ip As Long&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
'  PING NTP SERVER to check if NTP server is available&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
#if Use_ping = 1&lt;br /&gt;
   Dim J As Byte , Res As Byte&lt;br /&gt;
   Dim Ii As Byte&lt;br /&gt;
   Dim Ping_check_ok As Bit&lt;br /&gt;
&lt;br /&gt;
   Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
   ' FILL PING ARRAY&lt;br /&gt;
   S(1) = 8                                                    'type is echo&lt;br /&gt;
   S(2) = 0                                                    'code&lt;br /&gt;
&lt;br /&gt;
   S(3) = 0                                                    ' for checksum initialization&lt;br /&gt;
   S(4) = 0                                                    ' checksum&lt;br /&gt;
   S(5) = 0                                                    ' a signature can be any number&lt;br /&gt;
   S(6) = 1                                                    '   signature&lt;br /&gt;
   S(7) = 0                                                    ' sequence number - any number&lt;br /&gt;
   S(8) = 1&lt;br /&gt;
   S(9) = 65&lt;br /&gt;
&lt;br /&gt;
   Dim W As Word At S + 2 Overlay                              'same as dta(3) and dta(4)&lt;br /&gt;
   Dim B As Byte&lt;br /&gt;
   W = Tcpchecksum(s(1) , 9)                                   ' calculate checksum and store in dta(3) and dta(4)&lt;br /&gt;
&lt;br /&gt;
   'Ip = Maketcp(192.53.103.108)                                'try to check this google server&lt;br /&gt;
   Print &amp;quot;PING NTP Server : &amp;quot; ; Ip2str(ip_sntp_server)&lt;br /&gt;
&lt;br /&gt;
   'Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
   Setipprotocol Idx , 1                                       'set protocol to 1&lt;br /&gt;
   'the protocol value must be set BEFORE the socket is openend&lt;br /&gt;
&lt;br /&gt;
   Idx = Getsocket(idx , Sock_ipl_raw , 5000 , 0)              'RAW Socket&lt;br /&gt;
&lt;br /&gt;
   ' We try the PING 3 times (but if we get an answer we exit the for loop)&lt;br /&gt;
   Do&lt;br /&gt;
      Incr Ii&lt;br /&gt;
&lt;br /&gt;
      Result = Udpwrite(ip_sntp_server , 7 , Idx , S(1) , 9)   'write ping data               '&lt;br /&gt;
      Print &amp;quot;Ping Number : &amp;quot; ; ii&lt;br /&gt;
      Waitms 200                                               ' depending on the hops, speed, etc&lt;br /&gt;
      Result = Socketstat(idx , Sel_recv)                      'check for data&lt;br /&gt;
    '  Print &amp;quot;REC:&amp;quot; ; Result&lt;br /&gt;
      If Result &amp;gt;= 11 Then&lt;br /&gt;
&lt;br /&gt;
         Res = Tcpread(idx , R(1) , Result)                    'get data with TCPREAD !!!&lt;br /&gt;
&lt;br /&gt;
      '     Print &amp;quot;DATA RETURNED :&amp;quot; ; Res&lt;br /&gt;
      '(                     '&lt;br /&gt;
           For J = 1 To Result&lt;br /&gt;
             Print R(j) ; &amp;quot; &amp;quot; ;&lt;br /&gt;
           Next&lt;br /&gt;
            Print&lt;br /&gt;
      ')&lt;br /&gt;
            Print &amp;quot;PING OK --&amp;gt; Exit Do..Loop&amp;quot;&lt;br /&gt;
&lt;br /&gt;
            Set Ping_check_ok&lt;br /&gt;
&lt;br /&gt;
           Exit Do                                          ' If we can an answer from NTP Server exit do ... loop&lt;br /&gt;
&lt;br /&gt;
      Else&lt;br /&gt;
         Print &amp;quot;NTP Server not available&amp;quot;&lt;br /&gt;
      End If&lt;br /&gt;
      Waitms 100&lt;br /&gt;
&lt;br /&gt;
   Loop Until Ii = 3&lt;br /&gt;
&lt;br /&gt;
   Ii = 0&lt;br /&gt;
#else&lt;br /&gt;
  Dim Ping_check_ok As Bit&lt;br /&gt;
  Ping_check_ok = 1&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
'  SNTP&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
If Ping_check_ok = 1 Then                                   'When the NTP Serverer responded to PING&lt;br /&gt;
   'we need to get a socket first&lt;br /&gt;
   'note that for UDP we specify sock_dgram&lt;br /&gt;
   Idx = Getsocket(idx , Sock_dgram , 1000 , 0)                ' get socket for UDP mode, specify port&lt;br /&gt;
   Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
&lt;br /&gt;
   Local_time = Sntp(idx , Ip_sntp_server)                     ' get time from SNTP server&lt;br /&gt;
   Print &amp;quot;Local_time = &amp;quot; ; Local_time&lt;br /&gt;
&lt;br /&gt;
   If Local_time &amp;lt; 100 Then                                    'try it again&lt;br /&gt;
      Wait 1&lt;br /&gt;
      Local_time = Sntp(idx , Ip_sntp_server)                  ' get time from SNTP server&lt;br /&gt;
      Print &amp;quot;Second try ; Local_time = &amp;quot; ; Local_time&lt;br /&gt;
   End If&lt;br /&gt;
&lt;br /&gt;
   Local_time = Local_time + 3600                              ' (UTC/GMT) time + 3600&lt;br /&gt;
   Print Date(local_time) ; Spc(3) ; Time(local_time)&lt;br /&gt;
End If&lt;br /&gt;
&lt;br /&gt;
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++&lt;br /&gt;
'  +&lt;br /&gt;
'  + SUB NAME:      Send_Email()&lt;br /&gt;
'  +&lt;br /&gt;
'  + DESCRIPTION:   Send Email&lt;br /&gt;
'  +&lt;br /&gt;
'  +&lt;br /&gt;
'  + RETURN:        None&lt;br /&gt;
'  +&lt;br /&gt;
'  + NOTES:         None&lt;br /&gt;
'  +&lt;br /&gt;
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++&lt;br /&gt;
'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Sub Send_Email(byval Send_html As Byte) ' 0 = send Text, 1 = send HTML&lt;br /&gt;
&lt;br /&gt;
       '---------------------[SEND EMAIL SMTP]-----------------------------------------&lt;br /&gt;
    'for SMTP Email first we need a socket&lt;br /&gt;
    idx = Getsocket(smtp_email_socket , Sock_stream , 4086 , 0)&lt;br /&gt;
    If idx = 255 Then print &amp;quot;SMTP Email Getsocket Error&amp;quot;&lt;br /&gt;
'(&lt;br /&gt;
    result = Socketstat(idx , Sel_control)&lt;br /&gt;
&lt;br /&gt;
    Select Case result&lt;br /&gt;
      Case Sock_closed : print &amp;quot;Sock_closedr&amp;quot;&lt;br /&gt;
      Case Sock_arp : print &amp;quot;SOCK_ARP&amp;quot;&lt;br /&gt;
      Case Sock_listen : print &amp;quot;SOCK_LISTEN&amp;quot;&lt;br /&gt;
      Case Sock_synsent : print &amp;quot;SOCK_SYNSENT&amp;quot;&lt;br /&gt;
      Case Sock_synrecv : print &amp;quot;SOCK_SYNRECV&amp;quot;&lt;br /&gt;
      Case Sock_established : print &amp;quot;SOCK_ESTABLISHED&amp;quot;&lt;br /&gt;
      Case Sock_close_wait : print &amp;quot;SOCK_CLOSE_WAIT&amp;quot;&lt;br /&gt;
      Case Sock_last_ack : print &amp;quot;SOCK_LAST_ACK&amp;quot;&lt;br /&gt;
      Case Sock_fin_wait : print &amp;quot;SOCK_FIN_WAIT&amp;quot;&lt;br /&gt;
      Case Sock_closing : print &amp;quot;SOCK_CLOSING&amp;quot;&lt;br /&gt;
      Case Sock_time_wait : print &amp;quot;SOCK_TIME_WAIT&amp;quot;&lt;br /&gt;
      Case Sock_init : print &amp;quot;SOCK_INIT&amp;quot;&lt;br /&gt;
      Case Sock_udp : print &amp;quot;SOCK_UDP&amp;quot;&lt;br /&gt;
      Case Sock_raw : print &amp;quot;SOCK_RAW&amp;quot;&lt;br /&gt;
      Case Sock_macraw : print &amp;quot;SOCK_MACRAW&amp;quot;&lt;br /&gt;
      Case Sock_ppoe : print &amp;quot;SOCK_PPOE&amp;quot;&lt;br /&gt;
    End Select&lt;br /&gt;
')&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    'connect to smtp server&lt;br /&gt;
      result = Socketconnect(idx , 213.165.64.21 , 25)     ' smtp server and SMTP port 25&lt;br /&gt;
      '                        ^socket&lt;br /&gt;
      '                                 ^ ip address of the smtp server&lt;br /&gt;
      '                                               ^ port 25 for smtp&lt;br /&gt;
      print &amp;quot;Connecting to GMX Email Server: &amp;quot; ; &amp;quot; 213.165.64.21 Port 25 &amp;quot;&lt;br /&gt;
&lt;br /&gt;
      print &amp;quot;Socketconnect Status = &amp;quot; ; result&lt;br /&gt;
      If result = 1 Then print &amp;quot;ERROR connecting to 213.165.64.21 Port 25&amp;quot;&lt;br /&gt;
&lt;br /&gt;
      Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
      Do&lt;br /&gt;
            result = Socketstat(idx , 0)       ' get socket status&lt;br /&gt;
      Loop Until result = Sock_established&lt;br /&gt;
&lt;br /&gt;
      print &amp;quot;SMTP = &amp;quot; ; &amp;quot;SOCK_ESTABLISHED&amp;quot;&lt;br /&gt;
&lt;br /&gt;
      Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
       Do&lt;br /&gt;
           Tcp_var = Tcpread(idx , email_string)                 ' get response from SMTP server&lt;br /&gt;
           If Left(email_string , 3) = &amp;quot;220&amp;quot; Then&lt;br /&gt;
             print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
             Exit Do&lt;br /&gt;
           End If&lt;br /&gt;
           'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
       Loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
       print &amp;quot;Send &amp;quot; ; &amp;quot;HELO Arduino Ethernet{013}{010}&amp;quot;&lt;br /&gt;
       Tcp_var = Tcpwrite(idx , &amp;quot;HELO Arduino Ethernet{013}{010}&amp;quot; )       ' send username&lt;br /&gt;
       print Tcp_var ; &amp;quot;  bytes written&amp;quot;               ' number of bytes actual send&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
       Do&lt;br /&gt;
           Tcp_var = Tcpread(idx , email_string)                 ' get response from SMTP server&lt;br /&gt;
&lt;br /&gt;
           If Left(email_string , 3) = &amp;quot;250&amp;quot; Then&lt;br /&gt;
             print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
             Exit Do&lt;br /&gt;
           End If&lt;br /&gt;
           'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
       Loop&lt;br /&gt;
&lt;br /&gt;
       Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
       print &amp;quot;Send &amp;quot; ; &amp;quot;AUTH LOGIN{013}{010}&amp;quot;&lt;br /&gt;
&lt;br /&gt;
       Tcp_var = Tcpwrite(idx , &amp;quot;AUTH LOGIN{013}{010}&amp;quot; )       'authentication login&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
       Do&lt;br /&gt;
           Tcp_var = Tcpread(idx , email_string)                 ' get response from SMTP server&lt;br /&gt;
           If Left(email_string , 3) = &amp;quot;334&amp;quot; Then&lt;br /&gt;
              print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
              Exit Do&lt;br /&gt;
           End If&lt;br /&gt;
           'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
       Loop&lt;br /&gt;
&lt;br /&gt;
       Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
       'The username must be Base64 encoded (and add the CR + LF)!&lt;br /&gt;
       Tcp_var = Tcpwrite(idx , &amp;quot;**********************=={013}{010}&amp;quot; )     'USERNAME&lt;br /&gt;
&lt;br /&gt;
       Do&lt;br /&gt;
           Tcp_var = Tcpread(idx , email_string)                 ' get response from SMTP server&lt;br /&gt;
           If Left(email_string , 3) = &amp;quot;334&amp;quot; Then&lt;br /&gt;
              print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
              Exit Do&lt;br /&gt;
           End If&lt;br /&gt;
           'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
       Loop&lt;br /&gt;
&lt;br /&gt;
       Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
       'The password must be Base64 encoded (and add the CR + LF) !&lt;br /&gt;
       Tcp_var = Tcpwrite(idx , &amp;quot;********************=={013}{010}&amp;quot; )        'PASSWORD&lt;br /&gt;
&lt;br /&gt;
       Do&lt;br /&gt;
           Tcp_var = Tcpread(idx , email_string)                 ' get response from SMTP server&lt;br /&gt;
           If Left(email_string , 3) = &amp;quot;235&amp;quot; Then&lt;br /&gt;
              print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
              Exit Do&lt;br /&gt;
           End If&lt;br /&gt;
           'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
       Loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
       Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
       'Your Email address&lt;br /&gt;
       Tcp_var = Tcpwrite(idx , &amp;quot;MAIL FROM: *********@***.com{013}{010}&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
       Do&lt;br /&gt;
           Tcp_var = Tcpread(idx , email_string)                 ' get response from SMTP server&lt;br /&gt;
           If Left(email_string , 3) = &amp;quot;250&amp;quot; Then&lt;br /&gt;
                print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
                Exit Do&lt;br /&gt;
           End If&lt;br /&gt;
           'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
       Loop&lt;br /&gt;
&lt;br /&gt;
       Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
       'The Email address you want to send the message to&lt;br /&gt;
       Tcp_var = Tcpwrite(idx , &amp;quot;RCPT TO: ******@*****.com{013}{010}&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
       Do&lt;br /&gt;
          Tcp_var = Tcpread(idx , email_string)                  ' get response from SMTP server&lt;br /&gt;
          If Left(email_string , 3) = &amp;quot;250&amp;quot; Then&lt;br /&gt;
               print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
               Exit Do&lt;br /&gt;
          End If&lt;br /&gt;
          'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
       Loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
       Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
       Tcp_var = Tcpwrite(idx , &amp;quot;DATA{013}{010}&amp;quot; )&lt;br /&gt;
&lt;br /&gt;
       Do&lt;br /&gt;
          Tcp_var = Tcpread(idx , email_string)                  ' get response from SMTP server&lt;br /&gt;
               If Left(email_string , 3) = &amp;quot;354&amp;quot; Then&lt;br /&gt;
                  print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
                  Exit Do&lt;br /&gt;
               End If&lt;br /&gt;
               'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
       Loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
       Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
       Tcp_var = Tcpwrite(idx , &amp;quot;FROM: ********@***.de{013}{010}&amp;quot;)&lt;br /&gt;
       Tcp_var = Tcpwrite(idx , &amp;quot;TO: *******@****.com{013}{010}&amp;quot;)&lt;br /&gt;
       Tcp_var = Tcpwrite(idx , &amp;quot;SUBJECT: Arduino Ethernet Bascom{013}{010}&amp;quot;)&lt;br /&gt;
       Tcp_var = Tcpwrite(idx , &amp;quot;X-Mailer: BASCOM SMTP{013}{010}&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
       If Send_html = 1 Then&lt;br /&gt;
          '----------------------Send the Email as HTML ---------------------------&lt;br /&gt;
&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;Mime-Version: 1.0;{013}{010}&amp;quot;)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;Content-Type: text/html; charset={034}ISO-8859-1{034};{013}{010}&amp;quot;)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;Content-Transfer-Encoding: 7bit;{013}{010}&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;{013}{010}&amp;quot;)      'Empty line to switch to body&lt;br /&gt;
&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;html&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;body&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;h2&amp;gt;The Link to Bascom Forum !&amp;lt;/h2&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;Here is it: &amp;lt;a href={034}http://www.mcselec.com/index2.php?option=com_forum&amp;amp;Itemid=59{034}&amp;gt;Bascom Forum&amp;lt;/a&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;p&amp;gt;Best Regards,&amp;lt;/p&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;p&amp;gt;Arduino Ethernet Bascom&amp;lt;/p&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;/body&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;&amp;lt;/html&amp;gt;{013}{010}&amp;quot;)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;.{013}{010}&amp;quot;)&lt;br /&gt;
       Else&lt;br /&gt;
&lt;br /&gt;
             '-----------------------Send only TEXT-----------------------------------&lt;br /&gt;
&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;{013}{010}&amp;quot;)      'Empty line to switch from subject to body&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;This is a test email from BASCOM-AVR SMTP{013}{010}&amp;quot;)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;Arduino Ethernet Bascom{013}{010}&amp;quot;)&lt;br /&gt;
          email_string = &amp;quot;Timestamp = &amp;quot; + time$ + &amp;quot; / &amp;quot; + date$  + &amp;quot;{013}{010}&amp;quot;&lt;br /&gt;
          length = len(email_string)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , email_string, length)&lt;br /&gt;
          Tcp_var = Tcpwrite(idx , &amp;quot;.{013}{010}&amp;quot;)     ' end with a single dot&lt;br /&gt;
       end if&lt;br /&gt;
&lt;br /&gt;
       Reset Watchdog&lt;br /&gt;
&lt;br /&gt;
       Do&lt;br /&gt;
          Tcp_var = Tcpread(idx , email_string)                  ' get response from SMTP server&lt;br /&gt;
          If Left(email_string , 3) = &amp;quot;250&amp;quot; Then&lt;br /&gt;
                  print &amp;quot;Server Answer = &amp;quot; ; email_string         '--&amp;gt; 250 2.6.0 Message accepted&lt;br /&gt;
                  Exit Do&lt;br /&gt;
           End If&lt;br /&gt;
           'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
       Loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      print &amp;quot;Send &amp;quot; ; &amp;quot;QUIT{013}{010}&amp;quot;&lt;br /&gt;
      Tcp_var = Tcpwrite(idx , &amp;quot;QUIT{013}{010}&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      Do&lt;br /&gt;
         Tcp_var = Tcpread(idx , email_string)                   ' get response from SMTP server&lt;br /&gt;
          If Left(email_string , 3) = &amp;quot;221&amp;quot; Then&lt;br /&gt;
              print &amp;quot;Server Answer = &amp;quot; ; email_string&lt;br /&gt;
              Exit Do&lt;br /&gt;
          End If&lt;br /&gt;
          'The Watchdog will restart the micro in case of no or wrong answer&lt;br /&gt;
      Loop&lt;br /&gt;
&lt;br /&gt;
      Print &amp;quot;Close Socket&amp;quot;&lt;br /&gt;
      Closesocket Idx                                 ' close the server connection&lt;br /&gt;
&lt;br /&gt;
End Sub&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
reset watchdog&lt;br /&gt;
&lt;br /&gt;
'Here we send the email&lt;br /&gt;
&lt;br /&gt;
call Send_Email(0)       'Send text Email&lt;br /&gt;
wait 2 : reset watchdog&lt;br /&gt;
call Send_Email(1)       'Send Email in HTML&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Do&lt;br /&gt;
    If New_second = 1 Then&lt;br /&gt;
      Reset New_second&lt;br /&gt;
      reset watchdog&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
      'Do something every second ......&lt;br /&gt;
&lt;br /&gt;
      print &amp;quot;Tick&amp;quot;&lt;br /&gt;
&lt;br /&gt;
      incr second_counter&lt;br /&gt;
      if second_counter = 180 then&lt;br /&gt;
         second_counter = 0&lt;br /&gt;
         'Do something every 3 minutes ......&lt;br /&gt;
      end if&lt;br /&gt;
    End If&lt;br /&gt;
Loop&lt;br /&gt;
&lt;br /&gt;
End&lt;br /&gt;
&lt;br /&gt;
Timer_irq:&lt;br /&gt;
   Incr Local_time&lt;br /&gt;
   Time$ = Time(local_time)&lt;br /&gt;
   Date$ = Date(local_time)&lt;br /&gt;
   Set New_second&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Getdatetime:&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Settime:&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Setdate:&lt;br /&gt;
Return&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
.....&lt;br /&gt;
&lt;br /&gt;
== Telnet Exercise with sending an Email (if you encounter a problem)&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The AUTH LOGIN smtp command is used to login to the smtp server with Username and password (both must be sent Base64 encoded).&lt;br /&gt;
&lt;br /&gt;
You can use the Easy TCP/IP Tool in Bascom-AVR to decode or encode Base64.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;You can check all the single steps of the SMTP server communication with TELNET in a manual procedure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;1. Enabling Telnet Client in Windows 7&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp; [http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx]&amp;lt;br/&amp;gt;2. Start the DOS command window in Windows 7 and type telnet and return&amp;lt;br/&amp;gt;3. Then you see:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; Microsoft Telnet&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; in the DOS command window.&amp;lt;br/&amp;gt;4. Now type (we use as example GMX with Port 25):&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; open smtp.gmx.net 25&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; (25 is the port number)&amp;lt;br/&amp;gt;5. The answer from the SMTP server will be: &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;220 mail.gmx.net GMX Mailservices ESMTP {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;6. Then type:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; AUTH LOGIN&amp;lt;br/&amp;gt;7. The answer from the SMTP server will be: 334 &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;VXNlcm5hbWU6&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;8. If you decode the&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;VXNlcm5hbWU6&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;/span&amp;gt;for example with the Easy TCP/IP Tool in Bascom-AVR&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; you will notice that the decoded text is &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Username:&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;9. You need now to type in the username Base64 encoded (which is usually your Email address Base64 encoded)&amp;lt;br/&amp;gt;10. After this the SMTP server ask for the password (also Base64 encoded)&amp;lt;br/&amp;gt;11. If you type in the wrong username or password the server's answer is &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;535 5.7.0 Incorrect username or password {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;12. The correct username and password will be answerd by:&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;235 2.7.0 Go ahead {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;13. ...&amp;lt;br/&amp;gt;14. You can start the Email content with DATA and end it with &amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt;.&amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt; '''which is in Bascom {013}{010}.{013}{010}'''&lt;br /&gt;
&lt;br /&gt;
== SMTP Server Reply Codes&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Code Description&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;211 System status, or system help reply.&amp;lt;br/&amp;gt;214 Help message.&amp;lt;br/&amp;gt;220 Domain service ready.Ready to start TLS.&amp;lt;br/&amp;gt;221 Domain service closing transmission channel.&amp;lt;br/&amp;gt;250 Ok , Queuing For Node Node Started.requested Mail Action Okay , Completed.&amp;lt;br/&amp;gt;251 Ok , No Messages Waiting For Node Node.user Not Local , Will Forward To Forwardpath.&amp;lt;br/&amp;gt;252 OK, pending messages for node node started.Cannot VRFY user (e.g., info is not local), but will take message for this user and attempt delivery.&amp;lt;br/&amp;gt;253 OK, messages pending messages for node node started.&amp;lt;br/&amp;gt;354 Start mail input; end with &amp;amp;lt;CRLF&amp;amp;gt;.&amp;amp;lt;CRLF&amp;amp;gt;.&amp;lt;br/&amp;gt;355 Octet-offset is the transaction offset.&amp;lt;br/&amp;gt;421 Domain Service Not Available , Closing Transmission Channel.&amp;lt;br/&amp;gt;432 A password transition is needed.&amp;lt;br/&amp;gt;450 Requested mail action not taken: mailbox unavailable.ATRN request refused.&amp;lt;br/&amp;gt;451 Requested action aborted: local error in processing.Unable to process ATRN request now&amp;lt;br/&amp;gt;452 Requested action not taken: insufficient system storage.&amp;lt;br/&amp;gt;453 You have no mail.&amp;lt;br/&amp;gt;454 TLS not available due to temporary reason.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;458 Unable to queue messages for node node.&amp;lt;br/&amp;gt;459 Node node not allowed: reason.&amp;lt;br/&amp;gt;500 Command not recognized: command.Syntax error.&amp;lt;br/&amp;gt;501 Syntax error, no parameters allowed.&amp;lt;br/&amp;gt;502 Command not implemented.&amp;lt;br/&amp;gt;503 Bad sequence of commands.&amp;lt;br/&amp;gt;504 Command parameter not implemented.&amp;lt;br/&amp;gt;521 Machine does not accept mail.&amp;lt;br/&amp;gt;530 Must issue a STARTTLS command first.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;534 Authentication mechanism is too weak.&amp;lt;br/&amp;gt;538 Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;550 Requested action not taken: mailbox unavailable.&amp;lt;br/&amp;gt;551 User not local; please try forwardpath.&amp;lt;br/&amp;gt;552 Requested mail action aborted: exceeded storage allocation.&amp;lt;br/&amp;gt;553 Requested action not taken: mailbox name not allowed.&amp;lt;br/&amp;gt;554 Transaction failed.&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
......&lt;br /&gt;
&lt;br /&gt;
[[Category:Arduino Ethernet with Bascom-AVR]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)</id>
		<title>How to send an Email with Arduino and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-10T14:10:23Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Used Hardware&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
*Arduino UNO R3&lt;br /&gt;
*Ethernet Shield with W5100 Wiznet Chip &amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
== Used Software&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Bascom-AVR 2.0.7.6&lt;br /&gt;
&lt;br /&gt;
Windows7 or 8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== What you need to run the example&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
For the following example you need:&lt;br /&gt;
&lt;br /&gt;
*Email account which support&amp;lt;span dir=&amp;quot;auto&amp;quot;&amp;gt;SMTP Authentication&amp;lt;/span&amp;gt; (AUTH LOGIN) on Port 25&lt;br /&gt;
*Username and password Base64 encoded (you can use the Easy TCP/IP tool in Bascom-AVR to encode and decode)&lt;br /&gt;
*IP address of your smtp server (if you do not know it just open in Windows the DOS command window and ping the server)&lt;br /&gt;
*Your sender Email address and the receiver Email address&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;Don't use the Email Sub in the Do...Loop until you know what you are doing (Your mail provider could ban you if you send too much emails)&amp;amp;nbsp;!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This example use the base structure from here: [http://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100) http://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The focus of this article is Email and not other topics which are already descibed in other articels in this WIKI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You need to change the&amp;amp;nbsp; * (asterisk) !&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
.....&lt;br /&gt;
&lt;br /&gt;
== Telnet Exercise with sending an Email (if you encounter a problem)&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The AUTH LOGIN smtp command is used to login to the smtp server with Username and password (both must be sent Base64 encoded).&lt;br /&gt;
&lt;br /&gt;
You can use the Easy TCP/IP Tool in Bascom-AVR to decode or encode Base64.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;You can check all the single steps of the SMTP server communication with TELNET in a manual procedure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;1. Enabling Telnet Client in Windows 7&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp; [http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx]&amp;lt;br/&amp;gt;2. Start the DOS command window in Windows 7 and type telnet and return&amp;lt;br/&amp;gt;3. Then you see:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; Microsoft Telnet&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; in the DOS command window.&amp;lt;br/&amp;gt;4. Now type (we use as example GMX with Port 25):&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; open smtp.gmx.net 25&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; (25 is the port number)&amp;lt;br/&amp;gt;5. The answer from the SMTP server will be: &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;220 mail.gmx.net GMX Mailservices ESMTP {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;6. Then type:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; AUTH LOGIN&amp;lt;br/&amp;gt;7. The answer from the SMTP server will be: 334 &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;VXNlcm5hbWU6&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;8. If you decode the&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;VXNlcm5hbWU6&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;/span&amp;gt;for example with the Easy TCP/IP Tool in Bascom-AVR&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; you will notice that the decoded text is &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Username:&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;9. You need now to type in the username Base64 encoded (which is usually your Email address Base64 encoded)&amp;lt;br/&amp;gt;10. After this the SMTP server ask for the password (also Base64 encoded)&amp;lt;br/&amp;gt;11. If you type in the wrong username or password the server's answer is &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;535 5.7.0 Incorrect username or password {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;12. The correct username and password will be answerd by:&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;235 2.7.0 Go ahead {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;13. ...&amp;lt;br/&amp;gt;14. You can start the Email content with DATA and end it with &amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt;.&amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt; '''which is in Bascom {013}{010}.{013}{010}'''&lt;br /&gt;
&lt;br /&gt;
== SMTP Server Reply Codes&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Code Description&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;211 System status, or system help reply.&amp;lt;br/&amp;gt;214 Help message.&amp;lt;br/&amp;gt;220 Domain service ready.Ready to start TLS.&amp;lt;br/&amp;gt;221 Domain service closing transmission channel.&amp;lt;br/&amp;gt;250 Ok , Queuing For Node Node Started.requested Mail Action Okay , Completed.&amp;lt;br/&amp;gt;251 Ok , No Messages Waiting For Node Node.user Not Local , Will Forward To Forwardpath.&amp;lt;br/&amp;gt;252 OK, pending messages for node node started.Cannot VRFY user (e.g., info is not local), but will take message for this user and attempt delivery.&amp;lt;br/&amp;gt;253 OK, messages pending messages for node node started.&amp;lt;br/&amp;gt;354 Start mail input; end with &amp;amp;lt;CRLF&amp;amp;gt;.&amp;amp;lt;CRLF&amp;amp;gt;.&amp;lt;br/&amp;gt;355 Octet-offset is the transaction offset.&amp;lt;br/&amp;gt;421 Domain Service Not Available , Closing Transmission Channel.&amp;lt;br/&amp;gt;432 A password transition is needed.&amp;lt;br/&amp;gt;450 Requested mail action not taken: mailbox unavailable.ATRN request refused.&amp;lt;br/&amp;gt;451 Requested action aborted: local error in processing.Unable to process ATRN request now&amp;lt;br/&amp;gt;452 Requested action not taken: insufficient system storage.&amp;lt;br/&amp;gt;453 You have no mail.&amp;lt;br/&amp;gt;454 TLS not available due to temporary reason.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;458 Unable to queue messages for node node.&amp;lt;br/&amp;gt;459 Node node not allowed: reason.&amp;lt;br/&amp;gt;500 Command not recognized: command.Syntax error.&amp;lt;br/&amp;gt;501 Syntax error, no parameters allowed.&amp;lt;br/&amp;gt;502 Command not implemented.&amp;lt;br/&amp;gt;503 Bad sequence of commands.&amp;lt;br/&amp;gt;504 Command parameter not implemented.&amp;lt;br/&amp;gt;521 Machine does not accept mail.&amp;lt;br/&amp;gt;530 Must issue a STARTTLS command first.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;534 Authentication mechanism is too weak.&amp;lt;br/&amp;gt;538 Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;550 Requested action not taken: mailbox unavailable.&amp;lt;br/&amp;gt;551 User not local; please try forwardpath.&amp;lt;br/&amp;gt;552 Requested mail action aborted: exceeded storage allocation.&amp;lt;br/&amp;gt;553 Requested action not taken: mailbox name not allowed.&amp;lt;br/&amp;gt;554 Transaction failed.&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
......&lt;br /&gt;
&lt;br /&gt;
[[Category:Arduino Ethernet with Bascom-AVR]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)</id>
		<title>How to send an Email with Arduino and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-10T11:06:09Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Used Hardware&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
*Arduino UNO R3&lt;br /&gt;
*Ethernet Shield with W5100 Wiznet Chip &amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
== Used Software&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Bascom-AVR 2.0.7.6&lt;br /&gt;
&lt;br /&gt;
Windows7 or 8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== What you need to run the example&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
For the following example you need:&lt;br /&gt;
&lt;br /&gt;
*Email account which support&amp;lt;span dir=&amp;quot;auto&amp;quot;&amp;gt;SMTP Authentication&amp;lt;/span&amp;gt; (AUTH LOGIN) on Port 25&lt;br /&gt;
*Username and password Base64 encoded (you can use the Easy TCP/IP tool in Bascom-AVR to encode and decode)&lt;br /&gt;
*IP address of your smtp server (if you do not know it just open in Windows the DOS command window and ping the server)&lt;br /&gt;
*Your sender Email address and the receiver Email address&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;Don't use the Email Sub in the Do...Loop until you know what you are doing (Your mail provider could ban you if you send too much emails)&amp;amp;nbsp;!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This example use the base structure from here: [http://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100) http://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The focus of this article is Email and not other topics which are already descibed in other articels in this WIKI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
.....&lt;br /&gt;
&lt;br /&gt;
== Telnet Exercise with sending an Email (if you encounter a problem)&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The AUTH LOGIN smtp command is used to login to the smtp server with Username and password (both must be sent Base64 encoded).&lt;br /&gt;
&lt;br /&gt;
You can use the Easy TCP/IP Tool in Bascom-AVR to decode or encode Base64.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;You can check all the single steps of the SMTP server communication with TELNET in a manual procedure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;1. Enabling Telnet Client in Windows 7&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp; [http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx]&amp;lt;br/&amp;gt;2. Start the DOS command window in Windows 7 and type telnet and return&amp;lt;br/&amp;gt;3. Then you see:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; Microsoft Telnet&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; in the DOS command window.&amp;lt;br/&amp;gt;4. Now type (we use as example GMX with Port 25):&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; open smtp.gmx.net 25&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; (25 is the port number)&amp;lt;br/&amp;gt;5. The answer from the SMTP server will be: &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;220 mail.gmx.net GMX Mailservices ESMTP {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;6. Then type:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; AUTH LOGIN&amp;lt;br/&amp;gt;7. The answer from the SMTP server will be: 334 &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;VXNlcm5hbWU6&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;8. If you decode the&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;VXNlcm5hbWU6&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;/span&amp;gt;for example with the Easy TCP/IP Tool in Bascom-AVR&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; you will notice that the decoded text is &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Username:&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;9. You need now to type in the username Base64 encoded (which is usually your Email address Base64 encoded)&amp;lt;br/&amp;gt;10. After this the SMTP server ask for the password (also Base64 encoded)&amp;lt;br/&amp;gt;11. If you type in the wrong username or password the server's answer is &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;535 5.7.0 Incorrect username or password {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;12. The correct username and password will be answerd by:&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;235 2.7.0 Go ahead {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;13. ...&amp;lt;br/&amp;gt;14. You can start the Email content with DATA and end it with &amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt;.&amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt; '''which is in Bascom {013}{010}.{013}{010}'''&lt;br /&gt;
&lt;br /&gt;
== SMTP Server Reply Codes&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Code Description&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;211 System status, or system help reply.&amp;lt;br/&amp;gt;214 Help message.&amp;lt;br/&amp;gt;220 Domain service ready.Ready to start TLS.&amp;lt;br/&amp;gt;221 Domain service closing transmission channel.&amp;lt;br/&amp;gt;250 Ok , Queuing For Node Node Started.requested Mail Action Okay , Completed.&amp;lt;br/&amp;gt;251 Ok , No Messages Waiting For Node Node.user Not Local , Will Forward To Forwardpath.&amp;lt;br/&amp;gt;252 OK, pending messages for node node started.Cannot VRFY user (e.g., info is not local), but will take message for this user and attempt delivery.&amp;lt;br/&amp;gt;253 OK, messages pending messages for node node started.&amp;lt;br/&amp;gt;354 Start mail input; end with &amp;amp;lt;CRLF&amp;amp;gt;.&amp;amp;lt;CRLF&amp;amp;gt;.&amp;lt;br/&amp;gt;355 Octet-offset is the transaction offset.&amp;lt;br/&amp;gt;421 Domain Service Not Available , Closing Transmission Channel.&amp;lt;br/&amp;gt;432 A password transition is needed.&amp;lt;br/&amp;gt;450 Requested mail action not taken: mailbox unavailable.ATRN request refused.&amp;lt;br/&amp;gt;451 Requested action aborted: local error in processing.Unable to process ATRN request now&amp;lt;br/&amp;gt;452 Requested action not taken: insufficient system storage.&amp;lt;br/&amp;gt;453 You have no mail.&amp;lt;br/&amp;gt;454 TLS not available due to temporary reason.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;458 Unable to queue messages for node node.&amp;lt;br/&amp;gt;459 Node node not allowed: reason.&amp;lt;br/&amp;gt;500 Command not recognized: command.Syntax error.&amp;lt;br/&amp;gt;501 Syntax error, no parameters allowed.&amp;lt;br/&amp;gt;502 Command not implemented.&amp;lt;br/&amp;gt;503 Bad sequence of commands.&amp;lt;br/&amp;gt;504 Command parameter not implemented.&amp;lt;br/&amp;gt;521 Machine does not accept mail.&amp;lt;br/&amp;gt;530 Must issue a STARTTLS command first.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;534 Authentication mechanism is too weak.&amp;lt;br/&amp;gt;538 Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;550 Requested action not taken: mailbox unavailable.&amp;lt;br/&amp;gt;551 User not local; please try forwardpath.&amp;lt;br/&amp;gt;552 Requested mail action aborted: exceeded storage allocation.&amp;lt;br/&amp;gt;553 Requested action not taken: mailbox name not allowed.&amp;lt;br/&amp;gt;554 Transaction failed.&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
......&lt;br /&gt;
&lt;br /&gt;
[[Category:Arduino Ethernet with Bascom-AVR]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)</id>
		<title>How to send an Email with Arduino and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-10T11:04:42Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Used Hardware&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
*Arduino UNO R3&lt;br /&gt;
*Ethernet Shield with W5100 Wiznet Chip &amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
== Used Software&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Bascom-AVR 2.0.7.6&lt;br /&gt;
&lt;br /&gt;
Windows7 or 8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== What you need to run the example&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
For the following example you need:&lt;br /&gt;
&lt;br /&gt;
*Email account which support&amp;lt;span dir=&amp;quot;auto&amp;quot;&amp;gt;SMTP Authentication&amp;lt;/span&amp;gt; (AUTH LOGIN) on Port 25&lt;br /&gt;
*Username and password Base64 encoded (you can use the Easy TCP/IP tool in Bascom-AVR to encode and decode)&lt;br /&gt;
*IP address of your smtp server (if you do not know it just open in Windows the DOS command window and ping the server)&lt;br /&gt;
*Your sender Email address and the receiver Email address&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;Don't use the Email Sub in the Do...Loop until you know what you are doing (Your mail provider could ban you if you send too much emails)&amp;amp;nbsp;!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This example use the base structure from here: [http://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100) http://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The focus of this article is Email and not other topics which are already descibed in other articels in this WIKI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Telnet Exercise with sending an Email (if you encounter a problem)&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The AUTH LOGIN smtp command is used to login to the smtp server with Username and password (both must be sent Base64 encoded).&lt;br /&gt;
&lt;br /&gt;
You can use the Easy TCP/IP Tool in Bascom-AVR to decode or encode Base64.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;You can check all the single steps of the SMTP server communication with TELNET in a manual procedure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;1. Enabling Telnet Client in Windows 7&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp; [http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx]&amp;lt;br/&amp;gt;2. Start the DOS command window in Windows 7 and type telnet and return&amp;lt;br/&amp;gt;3. Then you see:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; Microsoft Telnet&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; in the DOS command window.&amp;lt;br/&amp;gt;4. Now type (we use as example GMX with Port 25):&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; open smtp.gmx.net 25&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; (25 is the port number)&amp;lt;br/&amp;gt;5. The answer from the SMTP server will be: &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;220 mail.gmx.net GMX Mailservices ESMTP {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;6. Then type:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; AUTH LOGIN&amp;lt;br/&amp;gt;7. The answer from the SMTP server will be: 334 &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;VXNlcm5hbWU6&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;8. If you decode the&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;VXNlcm5hbWU6&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;/span&amp;gt;for example with the Easy TCP/IP Tool in Bascom-AVR&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; you will notice that the decoded text is &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Username:&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;9. You need now to type in the username Base64 encoded (which is usually your Email address Base64 encoded)&amp;lt;br/&amp;gt;10. After this the SMTP server ask for the password (also Base64 encoded)&amp;lt;br/&amp;gt;11. If you type in the wrong username or password the server's answer is &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;535 5.7.0 Incorrect username or password {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;12. The correct username and password will be answerd by:&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;235 2.7.0 Go ahead {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;13. ...&amp;lt;br/&amp;gt;14. You can start the Email content with DATA and end it with &amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt;.&amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt; '''which is in Bascom {013}{010}.{013}{010}'''&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
.....&lt;br /&gt;
&lt;br /&gt;
== SMTP Server Reply Codes&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Code Description&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;211 System status, or system help reply.&amp;lt;br/&amp;gt;214 Help message.&amp;lt;br/&amp;gt;220 Domain service ready.Ready to start TLS.&amp;lt;br/&amp;gt;221 Domain service closing transmission channel.&amp;lt;br/&amp;gt;250 Ok , Queuing For Node Node Started.requested Mail Action Okay , Completed.&amp;lt;br/&amp;gt;251 Ok , No Messages Waiting For Node Node.user Not Local , Will Forward To Forwardpath.&amp;lt;br/&amp;gt;252 OK, pending messages for node node started.Cannot VRFY user (e.g., info is not local), but will take message for this user and attempt delivery.&amp;lt;br/&amp;gt;253 OK, messages pending messages for node node started.&amp;lt;br/&amp;gt;354 Start mail input; end with &amp;amp;lt;CRLF&amp;amp;gt;.&amp;amp;lt;CRLF&amp;amp;gt;.&amp;lt;br/&amp;gt;355 Octet-offset is the transaction offset.&amp;lt;br/&amp;gt;421 Domain Service Not Available , Closing Transmission Channel.&amp;lt;br/&amp;gt;432 A password transition is needed.&amp;lt;br/&amp;gt;450 Requested mail action not taken: mailbox unavailable.ATRN request refused.&amp;lt;br/&amp;gt;451 Requested action aborted: local error in processing.Unable to process ATRN request now&amp;lt;br/&amp;gt;452 Requested action not taken: insufficient system storage.&amp;lt;br/&amp;gt;453 You have no mail.&amp;lt;br/&amp;gt;454 TLS not available due to temporary reason.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;458 Unable to queue messages for node node.&amp;lt;br/&amp;gt;459 Node node not allowed: reason.&amp;lt;br/&amp;gt;500 Command not recognized: command.Syntax error.&amp;lt;br/&amp;gt;501 Syntax error, no parameters allowed.&amp;lt;br/&amp;gt;502 Command not implemented.&amp;lt;br/&amp;gt;503 Bad sequence of commands.&amp;lt;br/&amp;gt;504 Command parameter not implemented.&amp;lt;br/&amp;gt;521 Machine does not accept mail.&amp;lt;br/&amp;gt;530 Must issue a STARTTLS command first.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;534 Authentication mechanism is too weak.&amp;lt;br/&amp;gt;538 Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;550 Requested action not taken: mailbox unavailable.&amp;lt;br/&amp;gt;551 User not local; please try forwardpath.&amp;lt;br/&amp;gt;552 Requested mail action aborted: exceeded storage allocation.&amp;lt;br/&amp;gt;553 Requested action not taken: mailbox name not allowed.&amp;lt;br/&amp;gt;554 Transaction failed.&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
......&lt;br /&gt;
&lt;br /&gt;
[[Category:Arduino Ethernet with Bascom-AVR]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)</id>
		<title>How to send an Email with Arduino and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-10T11:01:05Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Used Hardware&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
*Arduino UNO R3&lt;br /&gt;
*Ethernet Shield with W5100 Wiznet Chip &amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
== Used Software&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Bascom-AVR 2.0.7.6&lt;br /&gt;
&lt;br /&gt;
Windows7 or 8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== What you need to run the example&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
For the following example you need:&lt;br /&gt;
&lt;br /&gt;
*Email account which support&amp;lt;span dir=&amp;quot;auto&amp;quot;&amp;gt;SMTP Authentication&amp;lt;/span&amp;gt; (AUTH LOGIN) on Port 25&lt;br /&gt;
*Username and password Base64 encoded (you can use the Easy TCP/IP tool in Bascom-AVR to encode and decode)&lt;br /&gt;
*IP address of your smtp server (if you do not know it just open in Windows the DOS command window and ping the server)&lt;br /&gt;
*Your sender Email address and the receiver Email address&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;Don't use the Email Sub in the Do...Loop until you know what you are doing (Your mail provider could ban you if you send too much emails)&amp;amp;nbsp;!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This example use the base structure from here: http://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Telnet Exercise with sending an Email (if you encounter a problem)&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The AUTH LOGIN smtp command is used to login to the smtp server with Username and password (both must be sent Base64 encoded).&lt;br /&gt;
&lt;br /&gt;
You can use the Easy TCP/IP Tool in Bascom-AVR to decode or encode Base64.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;You can check all the single steps of the SMTP server communication with TELNET in a manual procedure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;1. Enabling Telnet Client in Windows 7&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp; [http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx]&amp;lt;br/&amp;gt;2. Start the DOS command window in Windows 7 and type telnet and return&amp;lt;br/&amp;gt;3. Then you see:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; Microsoft Telnet&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; in the DOS command window.&amp;lt;br/&amp;gt;4. Now type (we use as example GMX with Port 25):&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; open smtp.gmx.net 25&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; (25 is the port number)&amp;lt;br/&amp;gt;5. The answer from the SMTP server will be: &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;220 mail.gmx.net GMX Mailservices ESMTP {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;6. Then type:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; AUTH LOGIN&amp;lt;br/&amp;gt;7. The answer from the SMTP server will be: 334 &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;VXNlcm5hbWU6&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;8. If you decode the&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;VXNlcm5hbWU6&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;/span&amp;gt;for example with the Easy TCP/IP Tool in Bascom-AVR&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; you will notice that the decoded text is &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Username:&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;9. You need now to type in the username Base64 encoded (which is usually your Email address Base64 encoded)&amp;lt;br/&amp;gt;10. After this the SMTP server ask for the password (also Base64 encoded)&amp;lt;br/&amp;gt;11. If you type in the wrong username or password the server's answer is &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;535 5.7.0 Incorrect username or password {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;12. The correct username and password will be answerd by:&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;235 2.7.0 Go ahead {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;13. ...&amp;lt;br/&amp;gt;14. You can start the Email content with DATA and end it with &amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt;.&amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt; '''which is in Bascom {013}{010}.{013}{010}'''&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
.....&lt;br /&gt;
&lt;br /&gt;
== SMTP Server Reply Codes&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Code Description&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;211 System status, or system help reply.&amp;lt;br/&amp;gt;214 Help message.&amp;lt;br/&amp;gt;220 Domain service ready.Ready to start TLS.&amp;lt;br/&amp;gt;221 Domain service closing transmission channel.&amp;lt;br/&amp;gt;250 Ok , Queuing For Node Node Started.requested Mail Action Okay , Completed.&amp;lt;br/&amp;gt;251 Ok , No Messages Waiting For Node Node.user Not Local , Will Forward To Forwardpath.&amp;lt;br/&amp;gt;252 OK, pending messages for node node started.Cannot VRFY user (e.g., info is not local), but will take message for this user and attempt delivery.&amp;lt;br/&amp;gt;253 OK, messages pending messages for node node started.&amp;lt;br/&amp;gt;354 Start mail input; end with &amp;amp;lt;CRLF&amp;amp;gt;.&amp;amp;lt;CRLF&amp;amp;gt;.&amp;lt;br/&amp;gt;355 Octet-offset is the transaction offset.&amp;lt;br/&amp;gt;421 Domain Service Not Available , Closing Transmission Channel.&amp;lt;br/&amp;gt;432 A password transition is needed.&amp;lt;br/&amp;gt;450 Requested mail action not taken: mailbox unavailable.ATRN request refused.&amp;lt;br/&amp;gt;451 Requested action aborted: local error in processing.Unable to process ATRN request now&amp;lt;br/&amp;gt;452 Requested action not taken: insufficient system storage.&amp;lt;br/&amp;gt;453 You have no mail.&amp;lt;br/&amp;gt;454 TLS not available due to temporary reason.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;458 Unable to queue messages for node node.&amp;lt;br/&amp;gt;459 Node node not allowed: reason.&amp;lt;br/&amp;gt;500 Command not recognized: command.Syntax error.&amp;lt;br/&amp;gt;501 Syntax error, no parameters allowed.&amp;lt;br/&amp;gt;502 Command not implemented.&amp;lt;br/&amp;gt;503 Bad sequence of commands.&amp;lt;br/&amp;gt;504 Command parameter not implemented.&amp;lt;br/&amp;gt;521 Machine does not accept mail.&amp;lt;br/&amp;gt;530 Must issue a STARTTLS command first.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;534 Authentication mechanism is too weak.&amp;lt;br/&amp;gt;538 Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;550 Requested action not taken: mailbox unavailable.&amp;lt;br/&amp;gt;551 User not local; please try forwardpath.&amp;lt;br/&amp;gt;552 Requested mail action aborted: exceeded storage allocation.&amp;lt;br/&amp;gt;553 Requested action not taken: mailbox name not allowed.&amp;lt;br/&amp;gt;554 Transaction failed.&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
......&lt;br /&gt;
&lt;br /&gt;
[[Category:Arduino Ethernet with Bascom-AVR]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)</id>
		<title>How to send an Email with Arduino and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-10T11:00:17Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Used Hardware&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
*Arduino UNO R3&lt;br /&gt;
*Ethernet Shield with W5100 Wiznet Chip &amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
== Used Software&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Bascom-AVR 2.0.7.6&lt;br /&gt;
&lt;br /&gt;
Windows7 or 8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== What you need to run the example&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
For the following example you need:&lt;br /&gt;
&lt;br /&gt;
*Email account which support&amp;lt;span dir=&amp;quot;auto&amp;quot;&amp;gt;SMTP Authentication&amp;lt;/span&amp;gt; (AUTH LOGIN) on Port 25&lt;br /&gt;
*Username and password Base64 encoded (you can use the Easy TCP/IP tool in Bascom-AVR to encode and decode)&lt;br /&gt;
*IP address of your smtp server (if you do not know it just open in Windows the DOS command window and ping the server)&lt;br /&gt;
*Your sender Email address and the receiver Email address&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;Don't use the Email Sub in the Do...Loop until you know what you are doing (Your mail provider could ban you if you send too much emails)&amp;amp;nbsp;!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This example use the base structure from here:&lt;br /&gt;
&lt;br /&gt;
== Telnet Exercise with sending an Email (if you encounter a problem)&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The AUTH LOGIN smtp command is used to login to the smtp server with Username and password (both must be sent Base64 encoded).&lt;br /&gt;
&lt;br /&gt;
You can use the Easy TCP/IP Tool in Bascom-AVR to decode or encode Base64.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;You can check all the single steps of the SMTP server communication with TELNET in a manual procedure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;1. Enabling Telnet Client in Windows 7&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp; [http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx]&amp;lt;br/&amp;gt;2. Start the DOS command window in Windows 7 and type telnet and return&amp;lt;br/&amp;gt;3. Then you see:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; Microsoft Telnet&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; in the DOS command window.&amp;lt;br/&amp;gt;4. Now type (we use as example GMX with Port 25):&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; open smtp.gmx.net 25&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; (25 is the port number)&amp;lt;br/&amp;gt;5. The answer from the SMTP server will be: &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;220 mail.gmx.net GMX Mailservices ESMTP {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;6. Then type:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; AUTH LOGIN&amp;lt;br/&amp;gt;7. The answer from the SMTP server will be: 334 &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;VXNlcm5hbWU6&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;8. If you decode the&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;VXNlcm5hbWU6&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;/span&amp;gt;for example with the Easy TCP/IP Tool in Bascom-AVR&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; you will notice that the decoded text is &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Username:&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;9. You need now to type in the username Base64 encoded (which is usually your Email address Base64 encoded)&amp;lt;br/&amp;gt;10. After this the SMTP server ask for the password (also Base64 encoded)&amp;lt;br/&amp;gt;11. If you type in the wrong username or password the server's answer is &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;535 5.7.0 Incorrect username or password {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;12. The correct username and password will be answerd by:&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;235 2.7.0 Go ahead {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;13. ...&amp;lt;br/&amp;gt;14. You can start the Email content with DATA and end it with &amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt;.&amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt; '''which is in Bascom {013}{010}.{013}{010}'''&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
.....&lt;br /&gt;
&lt;br /&gt;
== SMTP Server Reply Codes&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Code Description&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;211 System status, or system help reply.&amp;lt;br/&amp;gt;214 Help message.&amp;lt;br/&amp;gt;220 Domain service ready.Ready to start TLS.&amp;lt;br/&amp;gt;221 Domain service closing transmission channel.&amp;lt;br/&amp;gt;250 Ok , Queuing For Node Node Started.requested Mail Action Okay , Completed.&amp;lt;br/&amp;gt;251 Ok , No Messages Waiting For Node Node.user Not Local , Will Forward To Forwardpath.&amp;lt;br/&amp;gt;252 OK, pending messages for node node started.Cannot VRFY user (e.g., info is not local), but will take message for this user and attempt delivery.&amp;lt;br/&amp;gt;253 OK, messages pending messages for node node started.&amp;lt;br/&amp;gt;354 Start mail input; end with &amp;amp;lt;CRLF&amp;amp;gt;.&amp;amp;lt;CRLF&amp;amp;gt;.&amp;lt;br/&amp;gt;355 Octet-offset is the transaction offset.&amp;lt;br/&amp;gt;421 Domain Service Not Available , Closing Transmission Channel.&amp;lt;br/&amp;gt;432 A password transition is needed.&amp;lt;br/&amp;gt;450 Requested mail action not taken: mailbox unavailable.ATRN request refused.&amp;lt;br/&amp;gt;451 Requested action aborted: local error in processing.Unable to process ATRN request now&amp;lt;br/&amp;gt;452 Requested action not taken: insufficient system storage.&amp;lt;br/&amp;gt;453 You have no mail.&amp;lt;br/&amp;gt;454 TLS not available due to temporary reason.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;458 Unable to queue messages for node node.&amp;lt;br/&amp;gt;459 Node node not allowed: reason.&amp;lt;br/&amp;gt;500 Command not recognized: command.Syntax error.&amp;lt;br/&amp;gt;501 Syntax error, no parameters allowed.&amp;lt;br/&amp;gt;502 Command not implemented.&amp;lt;br/&amp;gt;503 Bad sequence of commands.&amp;lt;br/&amp;gt;504 Command parameter not implemented.&amp;lt;br/&amp;gt;521 Machine does not accept mail.&amp;lt;br/&amp;gt;530 Must issue a STARTTLS command first.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;534 Authentication mechanism is too weak.&amp;lt;br/&amp;gt;538 Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;550 Requested action not taken: mailbox unavailable.&amp;lt;br/&amp;gt;551 User not local; please try forwardpath.&amp;lt;br/&amp;gt;552 Requested mail action aborted: exceeded storage allocation.&amp;lt;br/&amp;gt;553 Requested action not taken: mailbox name not allowed.&amp;lt;br/&amp;gt;554 Transaction failed.&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
......&lt;br /&gt;
&lt;br /&gt;
[[Category:Arduino Ethernet with Bascom-AVR]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)</id>
		<title>How to send an Email with Arduino and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-10T10:58:06Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Used Hardware&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
*Arduino UNO R3&lt;br /&gt;
*Ethernet Shield with W5100 Wiznet Chip &amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
== Used Software&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Bascom-AVR 2.0.7.6&lt;br /&gt;
&lt;br /&gt;
Windows7 or 8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== What you need to run the example&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
For the following example you need:&lt;br /&gt;
&lt;br /&gt;
*Email account which support&amp;lt;span dir=&amp;quot;auto&amp;quot;&amp;gt;SMTP Authentication&amp;lt;/span&amp;gt; (AUTH LOGIN) on Port 25&lt;br /&gt;
*Username and password Base64 encoded (you can use the Easy TCP/IP tool in Bascom-AVR to encode and decode)&lt;br /&gt;
*IP address of your smtp server (if you do not know it just open in Windows the DOS command window and ping the server)&lt;br /&gt;
*Your sender Email address and the receiver Email address&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;Don't use the Email Sub in the Do...Loop until you know what you are doing (Your mail provider could ban you if you send too much emails)&amp;amp;nbsp;!&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Telnet Exercise with sending an Email (if you encounter a problem)&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The AUTH LOGIN smtp command is used to login to the smtp server with Username and password (both must be sent Base64 encoded).&lt;br /&gt;
&lt;br /&gt;
You can use the Easy TCP/IP Tool in Bascom-AVR to decode or encode Base64.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;You can check all the single steps of the SMTP server communication with TELNET in a manual procedure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;1. Enabling Telnet Client in Windows 7&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp; [http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx]&amp;lt;br/&amp;gt;2. Start the DOS command window in Windows 7 and type telnet and return&amp;lt;br/&amp;gt;3. Then you see:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; Microsoft Telnet&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; in the DOS command window.&amp;lt;br/&amp;gt;4. Now type (we use as example GMX with Port 25):&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; open smtp.gmx.net 25&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; (25 is the port number)&amp;lt;br/&amp;gt;5. The answer from the SMTP server will be: &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;220 mail.gmx.net GMX Mailservices ESMTP {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;6. Then type:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; AUTH LOGIN&amp;lt;br/&amp;gt;7. The answer from the SMTP server will be: 334 &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;VXNlcm5hbWU6&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;8. If you decode the&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;VXNlcm5hbWU6&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;/span&amp;gt;for example with the Easy TCP/IP Tool in Bascom-AVR&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; you will notice that the decoded text is &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Username:&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;9. You need now to type in the username Base64 encoded (which is usually your Email address Base64 encoded)&amp;lt;br/&amp;gt;10. After this the SMTP server ask for the password (also Base64 encoded)&amp;lt;br/&amp;gt;11. If you type in the wrong username or password the server's answer is &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;535 5.7.0 Incorrect username or password {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;12. The correct username and password will be answerd by:&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;235 2.7.0 Go ahead {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;13. ...&amp;lt;br/&amp;gt;14. You can start the Email content with DATA and end it with &amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt;.&amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt; '''which is in Bascom {013}{010}.{013}{010}'''&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
.....&lt;br /&gt;
&lt;br /&gt;
== SMTP Server Reply Codes&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Code Description&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;211 System status, or system help reply.&amp;lt;br/&amp;gt;214 Help message.&amp;lt;br/&amp;gt;220 Domain service ready.Ready to start TLS.&amp;lt;br/&amp;gt;221 Domain service closing transmission channel.&amp;lt;br/&amp;gt;250 Ok , Queuing For Node Node Started.requested Mail Action Okay , Completed.&amp;lt;br/&amp;gt;251 Ok , No Messages Waiting For Node Node.user Not Local , Will Forward To Forwardpath.&amp;lt;br/&amp;gt;252 OK, pending messages for node node started.Cannot VRFY user (e.g., info is not local), but will take message for this user and attempt delivery.&amp;lt;br/&amp;gt;253 OK, messages pending messages for node node started.&amp;lt;br/&amp;gt;354 Start mail input; end with &amp;amp;lt;CRLF&amp;amp;gt;.&amp;amp;lt;CRLF&amp;amp;gt;.&amp;lt;br/&amp;gt;355 Octet-offset is the transaction offset.&amp;lt;br/&amp;gt;421 Domain Service Not Available , Closing Transmission Channel.&amp;lt;br/&amp;gt;432 A password transition is needed.&amp;lt;br/&amp;gt;450 Requested mail action not taken: mailbox unavailable.ATRN request refused.&amp;lt;br/&amp;gt;451 Requested action aborted: local error in processing.Unable to process ATRN request now&amp;lt;br/&amp;gt;452 Requested action not taken: insufficient system storage.&amp;lt;br/&amp;gt;453 You have no mail.&amp;lt;br/&amp;gt;454 TLS not available due to temporary reason.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;458 Unable to queue messages for node node.&amp;lt;br/&amp;gt;459 Node node not allowed: reason.&amp;lt;br/&amp;gt;500 Command not recognized: command.Syntax error.&amp;lt;br/&amp;gt;501 Syntax error, no parameters allowed.&amp;lt;br/&amp;gt;502 Command not implemented.&amp;lt;br/&amp;gt;503 Bad sequence of commands.&amp;lt;br/&amp;gt;504 Command parameter not implemented.&amp;lt;br/&amp;gt;521 Machine does not accept mail.&amp;lt;br/&amp;gt;530 Must issue a STARTTLS command first.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;534 Authentication mechanism is too weak.&amp;lt;br/&amp;gt;538 Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;550 Requested action not taken: mailbox unavailable.&amp;lt;br/&amp;gt;551 User not local; please try forwardpath.&amp;lt;br/&amp;gt;552 Requested mail action aborted: exceeded storage allocation.&amp;lt;br/&amp;gt;553 Requested action not taken: mailbox name not allowed.&amp;lt;br/&amp;gt;554 Transaction failed.&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
......&lt;br /&gt;
&lt;br /&gt;
[[Category:Arduino Ethernet with Bascom-AVR]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)</id>
		<title>How to send an Email with Arduino and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-10T10:30:54Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Used Hardware&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
*Arduino UNO R3&lt;br /&gt;
*Ethernet Shield with W5100 Wiznet Chip &amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
== Used Software&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Bascom-AVR 2.0.7.6&lt;br /&gt;
&lt;br /&gt;
Windows7 or 8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== What you need to run the example&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
For the following example you need:&lt;br /&gt;
&lt;br /&gt;
*Email account which support&amp;lt;span dir=&amp;quot;auto&amp;quot;&amp;gt;SMTP Authentication&amp;lt;/span&amp;gt; (AUTH LOGIN) on Port 25&lt;br /&gt;
*Username and password Base64 encoded (you can use the Easy TCP/IP tool in Bascom-AVR to encode and decode)&lt;br /&gt;
*IP address of your smtp server (if you do not know it just open in Windows the DOS command window and ping the server)&lt;br /&gt;
*Your sender Email address and the receiver Email address&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;Don't use the Email in the Do...Loop until you know what you are doing (Your mail provider could ban you if you send too much emails) !&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Telnet Exercise with sending an Email (if you encounter a problem)&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The AUTH LOGIN smtp command is used to login to the smtp server with Username and password (both must be sent Base64 encoded).&lt;br /&gt;
&lt;br /&gt;
You can use the Easy TCP/IP Tool in Bascom-AVR to decode or encode Base64.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;You can check all the single steps of the SMTP server communication with TELNET in a manual procedure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;1. Enabling Telnet Client in Windows 7&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp; [http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx]&amp;lt;br/&amp;gt;2. Start the DOS command window in Windows 7 and type telnet and return&amp;lt;br/&amp;gt;3. Then you see:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; Microsoft Telnet&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; in the DOS command window.&amp;lt;br/&amp;gt;4. Now type (we use as example GMX with Port 25):&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; open smtp.gmx.net 25&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; (25 is the port number)&amp;lt;br/&amp;gt;5. The answer from the SMTP server will be: &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;220 mail.gmx.net GMX Mailservices ESMTP {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;6. Then type:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; AUTH LOGIN&amp;lt;br/&amp;gt;7. The answer from the SMTP server will be: 334 &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;VXNlcm5hbWU6&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;8. If you decode the&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;VXNlcm5hbWU6&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;/span&amp;gt;for example with the Easy TCP/IP Tool in Bascom-AVR&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; you will notice that the decoded text is &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Username:&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;9. You need now to type in the username Base64 encoded (which is usually your Email address Base64 encoded)&amp;lt;br/&amp;gt;10. After this the SMTP server ask for the password (also Base64 encoded)&amp;lt;br/&amp;gt;11. If you type in the wrong username or password the server's answer is &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;535 5.7.0 Incorrect username or password {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;12. The correct username and password will be answerd by:&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;235 2.7.0 Go ahead {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;13. ...&amp;lt;br/&amp;gt;14. You can start the Email content with DATA and end it with &amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt;.&amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt; '''which is in Bascom {013}{010}.{013}{010}'''&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
.....&lt;br /&gt;
&lt;br /&gt;
== SMTP Server Reply Codes&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Code Description&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;211 System status, or system help reply.&amp;lt;br/&amp;gt;214 Help message.&amp;lt;br/&amp;gt;220 Domain service ready.Ready to start TLS.&amp;lt;br/&amp;gt;221 Domain service closing transmission channel.&amp;lt;br/&amp;gt;250 Ok , Queuing For Node Node Started.requested Mail Action Okay , Completed.&amp;lt;br/&amp;gt;251 Ok , No Messages Waiting For Node Node.user Not Local , Will Forward To Forwardpath.&amp;lt;br/&amp;gt;252 OK, pending messages for node node started.Cannot VRFY user (e.g., info is not local), but will take message for this user and attempt delivery.&amp;lt;br/&amp;gt;253 OK, messages pending messages for node node started.&amp;lt;br/&amp;gt;354 Start mail input; end with &amp;amp;lt;CRLF&amp;amp;gt;.&amp;amp;lt;CRLF&amp;amp;gt;.&amp;lt;br/&amp;gt;355 Octet-offset is the transaction offset.&amp;lt;br/&amp;gt;421 Domain Service Not Available , Closing Transmission Channel.&amp;lt;br/&amp;gt;432 A password transition is needed.&amp;lt;br/&amp;gt;450 Requested mail action not taken: mailbox unavailable.ATRN request refused.&amp;lt;br/&amp;gt;451 Requested action aborted: local error in processing.Unable to process ATRN request now&amp;lt;br/&amp;gt;452 Requested action not taken: insufficient system storage.&amp;lt;br/&amp;gt;453 You have no mail.&amp;lt;br/&amp;gt;454 TLS not available due to temporary reason.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;458 Unable to queue messages for node node.&amp;lt;br/&amp;gt;459 Node node not allowed: reason.&amp;lt;br/&amp;gt;500 Command not recognized: command.Syntax error.&amp;lt;br/&amp;gt;501 Syntax error, no parameters allowed.&amp;lt;br/&amp;gt;502 Command not implemented.&amp;lt;br/&amp;gt;503 Bad sequence of commands.&amp;lt;br/&amp;gt;504 Command parameter not implemented.&amp;lt;br/&amp;gt;521 Machine does not accept mail.&amp;lt;br/&amp;gt;530 Must issue a STARTTLS command first.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;534 Authentication mechanism is too weak.&amp;lt;br/&amp;gt;538 Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;550 Requested action not taken: mailbox unavailable.&amp;lt;br/&amp;gt;551 User not local; please try forwardpath.&amp;lt;br/&amp;gt;552 Requested mail action aborted: exceeded storage allocation.&amp;lt;br/&amp;gt;553 Requested action not taken: mailbox name not allowed.&amp;lt;br/&amp;gt;554 Transaction failed.&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
......&lt;br /&gt;
&lt;br /&gt;
[[Category:Arduino Ethernet with Bascom-AVR]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)</id>
		<title>How to send an Email with Arduino and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-10T10:09:25Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Used Hardware&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
*Arduino UNO R3&lt;br /&gt;
*Ethernet Shield with W5100 Wiznet Chip &amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
== Used Software&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Bascom-AVR 2.0.7.6&lt;br /&gt;
&lt;br /&gt;
Windows7 or 8&lt;br /&gt;
&lt;br /&gt;
== Telnet Exercise with sending an Email (if you encounter a problem)&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The AUTH LOGIN smtp command is used to login to the smtp server with Username and password (both must be sent Base64 encoded).&lt;br /&gt;
&lt;br /&gt;
You can use the Easy TCP/IP Tool in Bascom-AVR to decode or encode Base64.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;You can check all the single steps of the SMTP server communication with TELNET in a manual procedure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;1. Enabling Telnet Client in Windows 7&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp; [http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx]&amp;lt;br/&amp;gt;2. Start the DOS command window in Windows 7 and type telnet and return&amp;lt;br/&amp;gt;3. Then you see:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; Microsoft Telnet&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; in the DOS command window.&amp;lt;br/&amp;gt;4. Now type (we use as example GMX with Port 25):&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; open smtp.gmx.net 25&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; (25 is the port number)&amp;lt;br/&amp;gt;5. The answer from the SMTP server will be: &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;220 mail.gmx.net GMX Mailservices ESMTP {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;6. Then type:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; AUTH LOGIN&amp;lt;br/&amp;gt;7. The answer from the SMTP server will be: 334 &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;VXNlcm5hbWU6&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;8. If you decode the&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;VXNlcm5hbWU6&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;/span&amp;gt;for example with the Easy TCP/IP Tool in Bascom-AVR&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; you will notice that the decoded text is &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Username:&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;9. You need now to type in the username Base64 encoded (which is usually your Email address Base64 encoded)&amp;lt;br/&amp;gt;10. After this the SMTP server ask for the password (also Base64 encoded)&amp;lt;br/&amp;gt;11. If you type in the wrong username or password the server's answer is &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;535 5.7.0 Incorrect username or password {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;12. The correct username and password will be answerd by:&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;235 2.7.0 Go ahead {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;13. ...&amp;lt;br/&amp;gt;14. You can start the Email content with DATA and end it with &amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt;.&amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt; '''which is in Bascom {013}{010}.{013}{010}'''&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
.....&lt;br /&gt;
&lt;br /&gt;
== SMTP Server Reply Codes&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Code Description&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;211 System status, or system help reply.&amp;lt;br/&amp;gt;214 Help message.&amp;lt;br/&amp;gt;220 Domain service ready.Ready to start TLS.&amp;lt;br/&amp;gt;221 Domain service closing transmission channel.&amp;lt;br/&amp;gt;250 Ok , Queuing For Node Node Started.requested Mail Action Okay , Completed.&amp;lt;br/&amp;gt;251 Ok , No Messages Waiting For Node Node.user Not Local , Will Forward To Forwardpath.&amp;lt;br/&amp;gt;252 OK, pending messages for node node started.Cannot VRFY user (e.g., info is not local), but will take message for this user and attempt delivery.&amp;lt;br/&amp;gt;253 OK, messages pending messages for node node started.&amp;lt;br/&amp;gt;354 Start mail input; end with &amp;amp;lt;CRLF&amp;amp;gt;.&amp;amp;lt;CRLF&amp;amp;gt;.&amp;lt;br/&amp;gt;355 Octet-offset is the transaction offset.&amp;lt;br/&amp;gt;421 Domain Service Not Available , Closing Transmission Channel.&amp;lt;br/&amp;gt;432 A password transition is needed.&amp;lt;br/&amp;gt;450 Requested mail action not taken: mailbox unavailable.ATRN request refused.&amp;lt;br/&amp;gt;451 Requested action aborted: local error in processing.Unable to process ATRN request now&amp;lt;br/&amp;gt;452 Requested action not taken: insufficient system storage.&amp;lt;br/&amp;gt;453 You have no mail.&amp;lt;br/&amp;gt;454 TLS not available due to temporary reason.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;458 Unable to queue messages for node node.&amp;lt;br/&amp;gt;459 Node node not allowed: reason.&amp;lt;br/&amp;gt;500 Command not recognized: command.Syntax error.&amp;lt;br/&amp;gt;501 Syntax error, no parameters allowed.&amp;lt;br/&amp;gt;502 Command not implemented.&amp;lt;br/&amp;gt;503 Bad sequence of commands.&amp;lt;br/&amp;gt;504 Command parameter not implemented.&amp;lt;br/&amp;gt;521 Machine does not accept mail.&amp;lt;br/&amp;gt;530 Must issue a STARTTLS command first.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;534 Authentication mechanism is too weak.&amp;lt;br/&amp;gt;538 Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;550 Requested action not taken: mailbox unavailable.&amp;lt;br/&amp;gt;551 User not local; please try forwardpath.&amp;lt;br/&amp;gt;552 Requested mail action aborted: exceeded storage allocation.&amp;lt;br/&amp;gt;553 Requested action not taken: mailbox name not allowed.&amp;lt;br/&amp;gt;554 Transaction failed.&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
......&lt;br /&gt;
&lt;br /&gt;
[[Category:Arduino Ethernet with Bascom-AVR]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)</id>
		<title>How to send an Email with Arduino and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-09T23:46:02Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Used Hardware&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
*Arduino UNO R3&lt;br /&gt;
*Ethernet Shield with W5100 Wiznet Chip &amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
== Used Software&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Bascom-AVR 2.0.7.6&lt;br /&gt;
&lt;br /&gt;
Windows7 or 8&lt;br /&gt;
&lt;br /&gt;
== Telnet Exercise with sending an Email&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The AUTH LOGIN smtp command is used to login to the smtp server with Username and password (both must be sent Base64 encoded).&lt;br /&gt;
&lt;br /&gt;
You can use the Easy TCP/IP Tool in Bascom-AVR to decode or encode Base64.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;You can check all the single steps of the SMTP server communication with TELNET in a manual procedure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;1. Enabling Telnet Client in Windows 7&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp; [http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx]&amp;lt;br/&amp;gt;2. Start the DOS command window in Windows 7 and type telnet and return&amp;lt;br/&amp;gt;3. Then you see:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; Microsoft Telnet&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; in the DOS command window.&amp;lt;br/&amp;gt;4. Now type (we use as example GMX with Port 25):&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; open smtp.gmx.net 25&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; (25 is the port number)&amp;lt;br/&amp;gt;5. The answer from the SMTP server will be: &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;220 mail.gmx.net GMX Mailservices ESMTP {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;6. Then type:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; AUTH LOGIN&amp;lt;br/&amp;gt;7. The answer from the SMTP server will be: 334 &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;VXNlcm5hbWU6&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;8. If you decode the&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;VXNlcm5hbWU6&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;/span&amp;gt;for example with the Easy TCP/IP Tool in Bascom-AVR&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; you will notice that the decoded text is &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Username:&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;9. You need now to type in the username Base64 encoded (which is usually your Email address Base64 encoded)&amp;lt;br/&amp;gt;10. After this the SMTP server ask for the password (also Base64 encoded)&amp;lt;br/&amp;gt;11. If you type in the wrong username or password the server's answer is &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;535 5.7.0 Incorrect username or password {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;12. The correct username and password will be answerd by:&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;235 2.7.0 Go ahead {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;13. ...&amp;lt;br/&amp;gt;14. You can start the Email content with DATA and end it with &amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt;.&amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt; '''which is in Bascom {013}{010}.{013}{010}'''&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
.....&lt;br /&gt;
&lt;br /&gt;
== SMTP Server Reply Codes&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Code Description&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;211 System status, or system help reply.&amp;lt;br/&amp;gt;214 Help message.&amp;lt;br/&amp;gt;220 Domain service ready.Ready to start TLS.&amp;lt;br/&amp;gt;221 Domain service closing transmission channel.&amp;lt;br/&amp;gt;250 Ok , Queuing For Node Node Started.requested Mail Action Okay , Completed.&amp;lt;br/&amp;gt;251 Ok , No Messages Waiting For Node Node.user Not Local , Will Forward To Forwardpath.&amp;lt;br/&amp;gt;252 OK, pending messages for node node started.Cannot VRFY user (e.g., info is not local), but will take message for this user and attempt delivery.&amp;lt;br/&amp;gt;253 OK, messages pending messages for node node started.&amp;lt;br/&amp;gt;354 Start mail input; end with &amp;amp;lt;CRLF&amp;amp;gt;.&amp;amp;lt;CRLF&amp;amp;gt;.&amp;lt;br/&amp;gt;355 Octet-offset is the transaction offset.&amp;lt;br/&amp;gt;421 Domain Service Not Available , Closing Transmission Channel.&amp;lt;br/&amp;gt;432 A password transition is needed.&amp;lt;br/&amp;gt;450 Requested mail action not taken: mailbox unavailable.ATRN request refused.&amp;lt;br/&amp;gt;451 Requested action aborted: local error in processing.Unable to process ATRN request now&amp;lt;br/&amp;gt;452 Requested action not taken: insufficient system storage.&amp;lt;br/&amp;gt;453 You have no mail.&amp;lt;br/&amp;gt;454 TLS not available due to temporary reason.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;458 Unable to queue messages for node node.&amp;lt;br/&amp;gt;459 Node node not allowed: reason.&amp;lt;br/&amp;gt;500 Command not recognized: command.Syntax error.&amp;lt;br/&amp;gt;501 Syntax error, no parameters allowed.&amp;lt;br/&amp;gt;502 Command not implemented.&amp;lt;br/&amp;gt;503 Bad sequence of commands.&amp;lt;br/&amp;gt;504 Command parameter not implemented.&amp;lt;br/&amp;gt;521 Machine does not accept mail.&amp;lt;br/&amp;gt;530 Must issue a STARTTLS command first.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;534 Authentication mechanism is too weak.&amp;lt;br/&amp;gt;538 Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;550 Requested action not taken: mailbox unavailable.&amp;lt;br/&amp;gt;551 User not local; please try forwardpath.&amp;lt;br/&amp;gt;552 Requested mail action aborted: exceeded storage allocation.&amp;lt;br/&amp;gt;553 Requested action not taken: mailbox name not allowed.&amp;lt;br/&amp;gt;554 Transaction failed.&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
......&lt;br /&gt;
&lt;br /&gt;
[[Category:Arduino Ethernet with Bascom-AVR]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)</id>
		<title>How to send an Email with Arduino and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-09T23:44:22Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Used Hardware&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
*Arduino UNO R3&lt;br /&gt;
*Ethernet Shield with W5100 Wiznet Chip &amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
== Used Software&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Bascom-AVR 2.0.7.6&lt;br /&gt;
&lt;br /&gt;
Windows8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Telnet Exercise with sending an Email&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The AUTH LOGIN smtp command is used to login to the smtp server with Username and password (both must be sent Base64 encoded).&lt;br /&gt;
&lt;br /&gt;
You can use the Easy TCP/IP Tool in Bascom-AVR to decode or encode Base64.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;You can check all the single steps of the SMTP server communication with TELNET in a manual procedure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;1. Enabling Telnet Client in Windows 7&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp; [http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx]&amp;lt;br/&amp;gt;2. Start the DOS command window in Windows 7 and type telnet and return&amp;lt;br/&amp;gt;3. Then you see:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; Microsoft Telnet&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; in the DOS command window.&amp;lt;br/&amp;gt;4. Now type (we use as example GMX with Port 25):&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; open smtp.gmx.net 25&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; (25 is the port number)&amp;lt;br/&amp;gt;5. The answer from the SMTP server will be: &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;220 mail.gmx.net GMX Mailservices ESMTP {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;6. Then type:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; AUTH LOGIN&amp;lt;br/&amp;gt;7. The answer from the SMTP server will be: 334 &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;VXNlcm5hbWU6&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;8. If you decode the&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;VXNlcm5hbWU6&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;/span&amp;gt;for example with the Easy TCP/IP Tool in Bascom-AVR&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; you will notice that the decoded text is &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Username:&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;9. You need now to type in the username Base64 encoded (which is usually your Email address Base64 encoded)&amp;lt;br/&amp;gt;10. After this the SMTP server ask for the password (also Base64 encoded)&amp;lt;br/&amp;gt;11. If you type in the wrong username or password the server's answer is &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;535 5.7.0 Incorrect username or password {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;12. The correct username and password will be answerd by:&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;235 2.7.0 Go ahead {mpXXX}&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;13. ...&amp;lt;br/&amp;gt;14. You can start the Email content with DATA and end it with &amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt;.&amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt; '''which is in Bascom {013}{010}.{013}{010}'''&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
.....&lt;br /&gt;
&lt;br /&gt;
== SMTP Server Reply Codes&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Code Description&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;211 System status, or system help reply.&amp;lt;br/&amp;gt;214 Help message.&amp;lt;br/&amp;gt;220 Domain service ready.Ready to start TLS.&amp;lt;br/&amp;gt;221 Domain service closing transmission channel.&amp;lt;br/&amp;gt;250 Ok , Queuing For Node Node Started.requested Mail Action Okay , Completed.&amp;lt;br/&amp;gt;251 Ok , No Messages Waiting For Node Node.user Not Local , Will Forward To Forwardpath.&amp;lt;br/&amp;gt;252 OK, pending messages for node node started.Cannot VRFY user (e.g., info is not local), but will take message for this user and attempt delivery.&amp;lt;br/&amp;gt;253 OK, messages pending messages for node node started.&amp;lt;br/&amp;gt;354 Start mail input; end with &amp;amp;lt;CRLF&amp;amp;gt;.&amp;amp;lt;CRLF&amp;amp;gt;.&amp;lt;br/&amp;gt;355 Octet-offset is the transaction offset.&amp;lt;br/&amp;gt;421 Domain Service Not Available , Closing Transmission Channel.&amp;lt;br/&amp;gt;432 A password transition is needed.&amp;lt;br/&amp;gt;450 Requested mail action not taken: mailbox unavailable.ATRN request refused.&amp;lt;br/&amp;gt;451 Requested action aborted: local error in processing.Unable to process ATRN request now&amp;lt;br/&amp;gt;452 Requested action not taken: insufficient system storage.&amp;lt;br/&amp;gt;453 You have no mail.&amp;lt;br/&amp;gt;454 TLS not available due to temporary reason.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;458 Unable to queue messages for node node.&amp;lt;br/&amp;gt;459 Node node not allowed: reason.&amp;lt;br/&amp;gt;500 Command not recognized: command.Syntax error.&amp;lt;br/&amp;gt;501 Syntax error, no parameters allowed.&amp;lt;br/&amp;gt;502 Command not implemented.&amp;lt;br/&amp;gt;503 Bad sequence of commands.&amp;lt;br/&amp;gt;504 Command parameter not implemented.&amp;lt;br/&amp;gt;521 Machine does not accept mail.&amp;lt;br/&amp;gt;530 Must issue a STARTTLS command first.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;534 Authentication mechanism is too weak.&amp;lt;br/&amp;gt;538 Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;550 Requested action not taken: mailbox unavailable.&amp;lt;br/&amp;gt;551 User not local; please try forwardpath.&amp;lt;br/&amp;gt;552 Requested mail action aborted: exceeded storage allocation.&amp;lt;br/&amp;gt;553 Requested action not taken: mailbox name not allowed.&amp;lt;br/&amp;gt;554 Transaction failed.&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
......&lt;br /&gt;
&lt;br /&gt;
[[Category:Arduino Ethernet with Bascom-AVR]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)</id>
		<title>How to send an Email with Arduino and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-09T23:42:59Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Used Hardware&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
*Arduino UNO R3&lt;br /&gt;
*Ethernet Shield with W5100 Wiznet Chip &amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
== Used Software&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Bascom-AVR 2.0.7.6&lt;br /&gt;
&lt;br /&gt;
Windows8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Telnet Exercise with sending an Email&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The AUTH LOGIN smtp command is used to login to the smtp server with Username and password (both must be sent Base64 encoded).&lt;br /&gt;
&lt;br /&gt;
You can use the Easy TCP/IP Tool in Bascom-AVR to decode or encode Base64.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;You can check all the single steps of the SMTP server communication with TELNET in a manual procedure:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;1. Enabling Telnet Client in Windows 7&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp; [http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx]&amp;lt;br/&amp;gt;2. Start the DOS command window in Windows 7 and type telnet and return&amp;lt;br/&amp;gt;3. Then you see:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; Microsoft Telnet&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; in the DOS command window.&amp;lt;br/&amp;gt;4. Now type (we use as example GMX with Port 25):&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; open smtp.gmx.net 25&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; (25 is the port number)&amp;lt;br/&amp;gt;5. The answer from the SMTP server will be: 220 mail.gmx.net GMX Mailservices ESMTP {mpXXX}&amp;lt;br/&amp;gt;6. Then type:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; AUTH LOGIN&amp;lt;br/&amp;gt;7. The answer from the SMTP server will be: 334 &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;VXNlcm5hbWU6&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;8. If you decode the&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;VXNlcm5hbWU6&amp;amp;nbsp;&amp;amp;nbsp; &amp;lt;/span&amp;gt;for example with the Easy TCP/IP Tool in Bascom-AVR&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; you will notice that the decoded text is &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Username:&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;9. You need now to type in the username Base64 encoded (which is usually your Email address Base64 encoded)&amp;lt;br/&amp;gt;10. After this the SMTP server ask for the password (also Base64 encoded)&amp;lt;br/&amp;gt;11. If you type in the wrong username or password the server's answer is 535 5.7.0 Incorrect username or password {mpXXX}&amp;lt;br/&amp;gt;12. The correct username and password will be answerd by:&amp;amp;nbsp;&amp;amp;nbsp; 235 2.7.0 Go ahead {mpXXX}&amp;lt;br/&amp;gt;13. ...&amp;lt;br/&amp;gt;14. You can start the Email content with DATA and end it with &amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt;.&amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt; '''which is in Bascom {013}{010}.{013}{010}'''&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
.....&lt;br /&gt;
&lt;br /&gt;
== SMTP Server Reply Codes&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Code Description&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;211 System status, or system help reply.&amp;lt;br/&amp;gt;214 Help message.&amp;lt;br/&amp;gt;220 Domain service ready.Ready to start TLS.&amp;lt;br/&amp;gt;221 Domain service closing transmission channel.&amp;lt;br/&amp;gt;250 Ok , Queuing For Node Node Started.requested Mail Action Okay , Completed.&amp;lt;br/&amp;gt;251 Ok , No Messages Waiting For Node Node.user Not Local , Will Forward To Forwardpath.&amp;lt;br/&amp;gt;252 OK, pending messages for node node started.Cannot VRFY user (e.g., info is not local), but will take message for this user and attempt delivery.&amp;lt;br/&amp;gt;253 OK, messages pending messages for node node started.&amp;lt;br/&amp;gt;354 Start mail input; end with &amp;amp;lt;CRLF&amp;amp;gt;.&amp;amp;lt;CRLF&amp;amp;gt;.&amp;lt;br/&amp;gt;355 Octet-offset is the transaction offset.&amp;lt;br/&amp;gt;421 Domain Service Not Available , Closing Transmission Channel.&amp;lt;br/&amp;gt;432 A password transition is needed.&amp;lt;br/&amp;gt;450 Requested mail action not taken: mailbox unavailable.ATRN request refused.&amp;lt;br/&amp;gt;451 Requested action aborted: local error in processing.Unable to process ATRN request now&amp;lt;br/&amp;gt;452 Requested action not taken: insufficient system storage.&amp;lt;br/&amp;gt;453 You have no mail.&amp;lt;br/&amp;gt;454 TLS not available due to temporary reason.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;458 Unable to queue messages for node node.&amp;lt;br/&amp;gt;459 Node node not allowed: reason.&amp;lt;br/&amp;gt;500 Command not recognized: command.Syntax error.&amp;lt;br/&amp;gt;501 Syntax error, no parameters allowed.&amp;lt;br/&amp;gt;502 Command not implemented.&amp;lt;br/&amp;gt;503 Bad sequence of commands.&amp;lt;br/&amp;gt;504 Command parameter not implemented.&amp;lt;br/&amp;gt;521 Machine does not accept mail.&amp;lt;br/&amp;gt;530 Must issue a STARTTLS command first.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;534 Authentication mechanism is too weak.&amp;lt;br/&amp;gt;538 Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;550 Requested action not taken: mailbox unavailable.&amp;lt;br/&amp;gt;551 User not local; please try forwardpath.&amp;lt;br/&amp;gt;552 Requested mail action aborted: exceeded storage allocation.&amp;lt;br/&amp;gt;553 Requested action not taken: mailbox name not allowed.&amp;lt;br/&amp;gt;554 Transaction failed.&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
......&lt;br /&gt;
&lt;br /&gt;
[[Category:Arduino Ethernet with Bascom-AVR]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)</id>
		<title>How to send an Email with Arduino and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-09T23:37:43Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Used Hardware&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
*Arduino UNO R3&lt;br /&gt;
*Ethernet Shield with W5100 Wiznet Chip &amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
== Used Software&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Bascom-AVR 2.0.7.6&lt;br /&gt;
&lt;br /&gt;
Windows8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Telnet Exercise with sending an Email&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;The following example request the NTP from a time server and send an email by communicating with an SMTP server&amp;lt;br/&amp;gt;SMTP&amp;amp;nbsp; = Simple Mail Transfer Protocol&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;The AUTH LOGIN smtp command is used to login to the smtp server with Username and password (both must be sent Base64 encrypted).&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;If you encounter problems you can check all the single steps of the SMTP server communication with TELNET&amp;lt;br/&amp;gt;1. Enabling Telnet Client in Windows 7&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp; [http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx]&amp;lt;br/&amp;gt;2. Start the DOS command window in Windows 7 and type telnet and return&amp;lt;br/&amp;gt;3. Then you see:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; Microsoft Telnet&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; in the DOS command window.&amp;lt;br/&amp;gt;4. Now type (in case of GMX):&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; open smtp.gmx.net 25&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; (25 is the port number)&amp;lt;br/&amp;gt;5. The answer from the SMTP server will be: 220 mail.gmx.net GMX Mailservices ESMTP {mpXXX}&amp;lt;br/&amp;gt;6. Then type:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; AUTH LOGIN&amp;lt;br/&amp;gt;7. The answer from the SMTP server will be: 334 VXNlcm5hbWU6&amp;lt;br/&amp;gt;8. If you decode the&amp;amp;nbsp;&amp;amp;nbsp; VXNlcm5hbWU6&amp;amp;nbsp;&amp;amp;nbsp; for example with the Easy TCP/IP Tool in Bascom-AVR&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; you will notice that the decoded text is Username:&amp;lt;br/&amp;gt;9. You need now to type in the username Base64 encoded (which is usually your Email address Base64 encoded)&amp;lt;br/&amp;gt;10. After this the SMTP server ask for the password (also Base64 encoded)&amp;lt;br/&amp;gt;11. If you type in the wrong username or password the server's answer is 535 5.7.0 Incorrect username or password {mpXXX}&amp;lt;br/&amp;gt;12. The correct username and password will be answerd by:&amp;amp;nbsp;&amp;amp;nbsp; 235 2.7.0 Go ahead {mpXXX}&amp;lt;br/&amp;gt;13. ...&amp;lt;br/&amp;gt;14. You can start the Email content with DATA and end it with &amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt;.&amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt; which is in Bascom {013}{010}.{013}{010}&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
.....&lt;br /&gt;
&lt;br /&gt;
== SMTP Server Reply Codes&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Code Description&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;211 System status, or system help reply.&amp;lt;br/&amp;gt;214 Help message.&amp;lt;br/&amp;gt;220 Domain service ready.Ready to start TLS.&amp;lt;br/&amp;gt;221 Domain service closing transmission channel.&amp;lt;br/&amp;gt;250 Ok , Queuing For Node Node Started.requested Mail Action Okay , Completed.&amp;lt;br/&amp;gt;251 Ok , No Messages Waiting For Node Node.user Not Local , Will Forward To Forwardpath.&amp;lt;br/&amp;gt;252 OK, pending messages for node node started.Cannot VRFY user (e.g., info is not local), but will take message for this user and attempt delivery.&amp;lt;br/&amp;gt;253 OK, messages pending messages for node node started.&amp;lt;br/&amp;gt;354 Start mail input; end with &amp;amp;lt;CRLF&amp;amp;gt;.&amp;amp;lt;CRLF&amp;amp;gt;.&amp;lt;br/&amp;gt;355 Octet-offset is the transaction offset.&amp;lt;br/&amp;gt;421 Domain Service Not Available , Closing Transmission Channel.&amp;lt;br/&amp;gt;432 A password transition is needed.&amp;lt;br/&amp;gt;450 Requested mail action not taken: mailbox unavailable.ATRN request refused.&amp;lt;br/&amp;gt;451 Requested action aborted: local error in processing.Unable to process ATRN request now&amp;lt;br/&amp;gt;452 Requested action not taken: insufficient system storage.&amp;lt;br/&amp;gt;453 You have no mail.&amp;lt;br/&amp;gt;454 TLS not available due to temporary reason.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;458 Unable to queue messages for node node.&amp;lt;br/&amp;gt;459 Node node not allowed: reason.&amp;lt;br/&amp;gt;500 Command not recognized: command.Syntax error.&amp;lt;br/&amp;gt;501 Syntax error, no parameters allowed.&amp;lt;br/&amp;gt;502 Command not implemented.&amp;lt;br/&amp;gt;503 Bad sequence of commands.&amp;lt;br/&amp;gt;504 Command parameter not implemented.&amp;lt;br/&amp;gt;521 Machine does not accept mail.&amp;lt;br/&amp;gt;530 Must issue a STARTTLS command first.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;534 Authentication mechanism is too weak.&amp;lt;br/&amp;gt;538 Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;550 Requested action not taken: mailbox unavailable.&amp;lt;br/&amp;gt;551 User not local; please try forwardpath.&amp;lt;br/&amp;gt;552 Requested mail action aborted: exceeded storage allocation.&amp;lt;br/&amp;gt;553 Requested action not taken: mailbox name not allowed.&amp;lt;br/&amp;gt;554 Transaction failed.&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
......&lt;br /&gt;
&lt;br /&gt;
[[Category:Arduino Ethernet with Bascom-AVR]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)</id>
		<title>How to send an Email with Arduino and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-09T23:36:07Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Used Hardware&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
*Arduino UNO R3&lt;br /&gt;
*Ethernet Shield with W5100 Wiznet Chip &amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
== Used Software&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Bascom-AVR 2.0.7.6&lt;br /&gt;
&lt;br /&gt;
Windows8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Telnet Exercise with sending an Email&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;The following example request the NTP from a time server and send an email by communicating with an SMTP server&amp;lt;br/&amp;gt;SMTP&amp;amp;nbsp; = Simple Mail Transfer Protocol&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;The AUTH LOGIN smtp command is used to login to the smtp server with Username and password (both must be sent Base64 encrypted).&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;If you encounter problems you can check all the single steps of the SMTP server communication with TELNET&amp;lt;br/&amp;gt;1. Enabling Telnet Client in Windows 7&amp;lt;br/&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp; http://social.technet.microsoft.com/wiki/contents/articles/910.enabling-telnet-client-in-windows-7.aspx&amp;lt;br/&amp;gt;2. Start the DOS command window in Windows 7 and type telnet and return&amp;lt;br/&amp;gt;3. Then you see:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; Microsoft Telnet&amp;gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; in the DOS command window.&amp;lt;br/&amp;gt;4. Now type (in case of GMX):&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; open smtp.gmx.net 25&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; (25 is the port number)&amp;lt;br/&amp;gt;5. The answer from the SMTP server will be: 220 mail.gmx.net GMX Mailservices ESMTP {mpXXX}&amp;lt;br/&amp;gt;6. Then type:&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; AUTH LOGIN&amp;lt;br/&amp;gt;' 7. The answer from the SMTP server will be: 334 VXNlcm5hbWU6&amp;lt;br/&amp;gt;' 8. If you decode the&amp;amp;nbsp;&amp;amp;nbsp; VXNlcm5hbWU6&amp;amp;nbsp;&amp;amp;nbsp; for example here&amp;amp;nbsp;&amp;amp;nbsp; http://www.base64decode.org/&amp;lt;br/&amp;gt;'&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; you will notice that the decoded text is Username:&amp;lt;br/&amp;gt;' 9. You need now to type in the username Base64 encoded (which is usually your Email address Base64 encoded)&amp;lt;br/&amp;gt;'10. After this the SMTP server ask for the password (also Base64 encoded)&amp;lt;br/&amp;gt;'11. If you type in the wrong username or password the server's answer is 535 5.7.0 Incorrect username or password {mpXXX}&amp;lt;br/&amp;gt;'12. The correct username and password will be answerd by:&amp;amp;nbsp;&amp;amp;nbsp; 235 2.7.0 Go ahead {mpXXX}&amp;lt;br/&amp;gt;'13. ...&amp;lt;br/&amp;gt;'14. You can start the Email content with DATA and end it with &amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt;.&amp;amp;lt;CR&amp;amp;gt;&amp;amp;lt;LF&amp;amp;gt; which is in Bascom {013}{010}.{013}{010}&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
.....&lt;br /&gt;
&lt;br /&gt;
== SMTP Server Reply Codes&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Code Description&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;211 System status, or system help reply.&amp;lt;br/&amp;gt;214 Help message.&amp;lt;br/&amp;gt;220 Domain service ready.Ready to start TLS.&amp;lt;br/&amp;gt;221 Domain service closing transmission channel.&amp;lt;br/&amp;gt;250 Ok , Queuing For Node Node Started.requested Mail Action Okay , Completed.&amp;lt;br/&amp;gt;251 Ok , No Messages Waiting For Node Node.user Not Local , Will Forward To Forwardpath.&amp;lt;br/&amp;gt;252 OK, pending messages for node node started.Cannot VRFY user (e.g., info is not local), but will take message for this user and attempt delivery.&amp;lt;br/&amp;gt;253 OK, messages pending messages for node node started.&amp;lt;br/&amp;gt;354 Start mail input; end with &amp;amp;lt;CRLF&amp;amp;gt;.&amp;amp;lt;CRLF&amp;amp;gt;.&amp;lt;br/&amp;gt;355 Octet-offset is the transaction offset.&amp;lt;br/&amp;gt;421 Domain Service Not Available , Closing Transmission Channel.&amp;lt;br/&amp;gt;432 A password transition is needed.&amp;lt;br/&amp;gt;450 Requested mail action not taken: mailbox unavailable.ATRN request refused.&amp;lt;br/&amp;gt;451 Requested action aborted: local error in processing.Unable to process ATRN request now&amp;lt;br/&amp;gt;452 Requested action not taken: insufficient system storage.&amp;lt;br/&amp;gt;453 You have no mail.&amp;lt;br/&amp;gt;454 TLS not available due to temporary reason.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;458 Unable to queue messages for node node.&amp;lt;br/&amp;gt;459 Node node not allowed: reason.&amp;lt;br/&amp;gt;500 Command not recognized: command.Syntax error.&amp;lt;br/&amp;gt;501 Syntax error, no parameters allowed.&amp;lt;br/&amp;gt;502 Command not implemented.&amp;lt;br/&amp;gt;503 Bad sequence of commands.&amp;lt;br/&amp;gt;504 Command parameter not implemented.&amp;lt;br/&amp;gt;521 Machine does not accept mail.&amp;lt;br/&amp;gt;530 Must issue a STARTTLS command first.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;534 Authentication mechanism is too weak.&amp;lt;br/&amp;gt;538 Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;550 Requested action not taken: mailbox unavailable.&amp;lt;br/&amp;gt;551 User not local; please try forwardpath.&amp;lt;br/&amp;gt;552 Requested mail action aborted: exceeded storage allocation.&amp;lt;br/&amp;gt;553 Requested action not taken: mailbox name not allowed.&amp;lt;br/&amp;gt;554 Transaction failed.&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
......&lt;br /&gt;
&lt;br /&gt;
[[Category:Arduino Ethernet with Bascom-AVR]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)</id>
		<title>How to send an Email with Arduino and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-09T23:32:31Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Used Hardware&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
*Arduino UNO R3&lt;br /&gt;
*Ethernet Shield with W5100 Wiznet Chip &amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
== Used Software&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Bascom-AVR 2.0.7.6&lt;br /&gt;
&lt;br /&gt;
Windows8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
.....&lt;br /&gt;
&lt;br /&gt;
== SMTP Server Reply Codes&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Code Description&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;211 System status, or system help reply.&amp;lt;br/&amp;gt;214 Help message.&amp;lt;br/&amp;gt;220 Domain service ready.Ready to start TLS.&amp;lt;br/&amp;gt;221 Domain service closing transmission channel.&amp;lt;br/&amp;gt;250 Ok , Queuing For Node Node Started.requested Mail Action Okay , Completed.&amp;lt;br/&amp;gt;251 Ok , No Messages Waiting For Node Node.user Not Local , Will Forward To Forwardpath.&amp;lt;br/&amp;gt;252 OK, pending messages for node node started.Cannot VRFY user (e.g., info is not local), but will take message for this user and attempt delivery.&amp;lt;br/&amp;gt;253 OK, messages pending messages for node node started.&amp;lt;br/&amp;gt;354 Start mail input; end with &amp;amp;lt;CRLF&amp;amp;gt;.&amp;amp;lt;CRLF&amp;amp;gt;.&amp;lt;br/&amp;gt;355 Octet-offset is the transaction offset.&amp;lt;br/&amp;gt;421 Domain Service Not Available , Closing Transmission Channel.&amp;lt;br/&amp;gt;432 A password transition is needed.&amp;lt;br/&amp;gt;450 Requested mail action not taken: mailbox unavailable.ATRN request refused.&amp;lt;br/&amp;gt;451 Requested action aborted: local error in processing.Unable to process ATRN request now&amp;lt;br/&amp;gt;452 Requested action not taken: insufficient system storage.&amp;lt;br/&amp;gt;453 You have no mail.&amp;lt;br/&amp;gt;454 TLS not available due to temporary reason.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;458 Unable to queue messages for node node.&amp;lt;br/&amp;gt;459 Node node not allowed: reason.&amp;lt;br/&amp;gt;500 Command not recognized: command.Syntax error.&amp;lt;br/&amp;gt;501 Syntax error, no parameters allowed.&amp;lt;br/&amp;gt;502 Command not implemented.&amp;lt;br/&amp;gt;503 Bad sequence of commands.&amp;lt;br/&amp;gt;504 Command parameter not implemented.&amp;lt;br/&amp;gt;521 Machine does not accept mail.&amp;lt;br/&amp;gt;530 Must issue a STARTTLS command first.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;534 Authentication mechanism is too weak.&amp;lt;br/&amp;gt;538 Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;550 Requested action not taken: mailbox unavailable.&amp;lt;br/&amp;gt;551 User not local; please try forwardpath.&amp;lt;br/&amp;gt;552 Requested mail action aborted: exceeded storage allocation.&amp;lt;br/&amp;gt;553 Requested action not taken: mailbox name not allowed.&amp;lt;br/&amp;gt;554 Transaction failed.&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
......&lt;br /&gt;
&lt;br /&gt;
[[Category:Arduino Ethernet with Bascom-AVR]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)</id>
		<title>How to send an Email with Arduino and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-09T23:31:59Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Used Hardware&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
*Arduino UNO R3&lt;br /&gt;
*Ethernet Shield with W5100 Wiznet Chip &amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
== Used Software&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Bascom-AVR 2.0.7.6&lt;br /&gt;
&lt;br /&gt;
Windows8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== SMTP Server Reply Codes&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Code Description&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;211 System status, or system help reply.&amp;lt;br/&amp;gt;214 Help message.&amp;lt;br/&amp;gt;220 Domain service ready.Ready to start TLS.&amp;lt;br/&amp;gt;221 Domain service closing transmission channel.&amp;lt;br/&amp;gt;250 Ok , Queuing For Node Node Started.requested Mail Action Okay , Completed.&amp;lt;br/&amp;gt;251 Ok , No Messages Waiting For Node Node.user Not Local , Will Forward To Forwardpath.&amp;lt;br/&amp;gt;252 OK, pending messages for node node started.Cannot VRFY user (e.g., info is not local), but will take message for this user and attempt delivery.&amp;lt;br/&amp;gt;253 OK, messages pending messages for node node started.&amp;lt;br/&amp;gt;354 Start mail input; end with &amp;amp;lt;CRLF&amp;amp;gt;.&amp;amp;lt;CRLF&amp;amp;gt;.&amp;lt;br/&amp;gt;355 Octet-offset is the transaction offset.&amp;lt;br/&amp;gt;421 Domain Service Not Available , Closing Transmission Channel.&amp;lt;br/&amp;gt;432 A password transition is needed.&amp;lt;br/&amp;gt;450 Requested mail action not taken: mailbox unavailable.ATRN request refused.&amp;lt;br/&amp;gt;451 Requested action aborted: local error in processing.Unable to process ATRN request now&amp;lt;br/&amp;gt;452 Requested action not taken: insufficient system storage.&amp;lt;br/&amp;gt;453 You have no mail.&amp;lt;br/&amp;gt;454 TLS not available due to temporary reason.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;458 Unable to queue messages for node node.&amp;lt;br/&amp;gt;459 Node node not allowed: reason.&amp;lt;br/&amp;gt;500 Command not recognized: command.Syntax error.&amp;lt;br/&amp;gt;501 Syntax error, no parameters allowed.&amp;lt;br/&amp;gt;502 Command not implemented.&amp;lt;br/&amp;gt;503 Bad sequence of commands.&amp;lt;br/&amp;gt;504 Command parameter not implemented.&amp;lt;br/&amp;gt;521 Machine does not accept mail.&amp;lt;br/&amp;gt;530 Must issue a STARTTLS command first.Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;534 Authentication mechanism is too weak.&amp;lt;br/&amp;gt;538 Encryption required for requested authentication mechanism.&amp;lt;br/&amp;gt;550 Requested action not taken: mailbox unavailable.&amp;lt;br/&amp;gt;551 User not local; please try forwardpath.&amp;lt;br/&amp;gt;552 Requested mail action aborted: exceeded storage allocation.&amp;lt;br/&amp;gt;553 Requested action not taken: mailbox name not allowed.&amp;lt;br/&amp;gt;554 Transaction failed.&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
......&lt;br /&gt;
&lt;br /&gt;
[[Category:Arduino Ethernet with Bascom-AVR]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)</id>
		<title>How to send an Email with Arduino and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-09T23:24:51Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Used Hardware&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
*Arduino UNO R3&lt;br /&gt;
*Ethernet Shield with W5100 Wiznet Chip &amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
== Used Software&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Bascom-AVR 2.0.7.6&lt;br /&gt;
&lt;br /&gt;
Windows8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
......&lt;br /&gt;
&lt;br /&gt;
[[Category:Arduino Ethernet with Bascom-AVR]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)</id>
		<title>How to send an Email with Arduino and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-09T23:23:36Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Used Hardware&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
*Arduino UNO R3&lt;br /&gt;
*Ethernet Shield with W5100 Wiznet Chip &amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
......&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Arduino Ethernet with Bascom-AVR]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)</id>
		<title>How to send an Email with Arduino and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/How_to_send_an_Email_with_Arduino_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-09T23:22:06Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: Created page with &amp;quot;== Under Construction&amp;lt;br/&amp;gt; ==        Category:Arduino Ethernet with Bascom-AVR&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Under Construction&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Arduino Ethernet with Bascom-AVR]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)</id>
		<title>Getting started with Arduino UNO R3 and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-09T08:31:09Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Please read first this Article:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Getting started with Arduino and WIZ820io http://wiki.mcselec.com/Getting_started_with_Arduino_and_WIZ820io&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It uses the same source code exept we use here an Wiznet W5100 Chip intead of W5200 so only '''config TCPIP '''needs to be changed.&lt;br /&gt;
&lt;br /&gt;
The usage of Easy TCP/IP in combination with that example is also the same.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The used Ethernet Shield is this here: [http://arduino.cc/en/Guide/ArduinoEthernetShield http://arduino.cc/en/Guide/ArduinoEthernetShield]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;Another difference is that in this example we do not use the Bascom-AVR bootloader. We use here the existing Arduino bootloader.&lt;br /&gt;
&lt;br /&gt;
To get started with this see here:&amp;amp;nbsp; [http://wiki.mcselec.com/Getting_started_with_Arduino_UNO http://wiki.mcselec.com/Getting_started_with_Arduino_UNO]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Arduino ethernet shield w5100.PNG|border|center|600x600px|Arduino ethernet shield w5100.PNG]]&lt;br /&gt;
&lt;br /&gt;
== Source Code:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The difference is only this part in the Bascom source code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
'Here you need MAC address, the ip address you like to use, subnet mask, gateway and localport&lt;br /&gt;
 Config Tcpip = Noint , _&lt;br /&gt;
 Mac = 1.1.94.127.1.255 , _&lt;br /&gt;
 Ip = 192.168.2.254 , _&lt;br /&gt;
 Submask = 255.255.255.0 , _&lt;br /&gt;
 Gateway = 192.168.2.1 , _&lt;br /&gt;
 Localport = 1000 , _&lt;br /&gt;
 Tx = $55 , Rx = $55 , _&lt;br /&gt;
 Chip = W5100 , _&lt;br /&gt;
 Spi = 1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Complete Source code:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
' IP Address of Arduino = 192.168.2.254&lt;br /&gt;
' Port of Arduino = 1000&lt;br /&gt;
' We use UDP&lt;br /&gt;
'&lt;br /&gt;
&lt;br /&gt;
'Use Hardware:&lt;br /&gt;
' - Arduino UNO R3&lt;br /&gt;
' - Arduino Ethernet Shield with W5100 Wiznet Chip&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
' NTP Server IP address (here you can change the NTP server of your choice)&lt;br /&gt;
Const Ntp1 = 192 : Const Ntp2 = 53 : Const Ntp3 = 103 : Const Ntp4 = 108 ' Example = 192.53.103.108&lt;br /&gt;
&lt;br /&gt;
Const Use_ping = 1 'use PING NTP server for checking NTP server availability before move on&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$regfile = &amp;quot;m328pdef.dat&amp;quot;&lt;br /&gt;
$crystal = 16000000 '16MHz&lt;br /&gt;
$hwstack = 100&lt;br /&gt;
$swstack = 100&lt;br /&gt;
$framesize = 400&lt;br /&gt;
&lt;br /&gt;
Config Com1 = 57600 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Server Variables&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Ip_sntp_server As Long&lt;br /&gt;
'assign the IP number of a SNTP server&lt;br /&gt;
Ip_sntp_server = Maketcp(ntp1 , Ntp2 , Ntp3 , Ntp4) 'assign IP of NTP SERVER&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Wait 2&lt;br /&gt;
Print&lt;br /&gt;
Print &amp;quot;-----START Arduino UNO R3 + Ethernet Shield DEMO-----&amp;quot;&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Network Hardware&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = Low , Phase = 0 , Clockrate = 4 , Noss = 0&lt;br /&gt;
Spiinit&lt;br /&gt;
&lt;br /&gt;
Print&lt;br /&gt;
Enable Interrupts&lt;br /&gt;
&lt;br /&gt;
 'Here you need MAC address, the ip address you like to use, subnet mask, gateway and localport&lt;br /&gt;
 Config Tcpip = Noint , _&lt;br /&gt;
 Mac = 1.1.94.127.1.255 , _&lt;br /&gt;
 Ip = 192.168.2.254 , _&lt;br /&gt;
 Submask = 255.255.255.0 , _&lt;br /&gt;
 Gateway = 192.168.2.1 , _&lt;br /&gt;
 Localport = 1000 , _&lt;br /&gt;
 Tx = $55 , Rx = $55 , _&lt;br /&gt;
 Chip = W5100 , _&lt;br /&gt;
 Spi = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Config Clock&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Local_time As Long&lt;br /&gt;
Dim New_second As Bit&lt;br /&gt;
&lt;br /&gt;
Config Date = Dmy , Separator = .&lt;br /&gt;
Config Clock = User&lt;br /&gt;
&lt;br /&gt;
Config Timer1 = Timer , Prescale = 256&lt;br /&gt;
On Timer1 Timer_irq Saveall 'the SAVEALL option is NEEDED !&lt;br /&gt;
Const Timer_preload = 3036&lt;br /&gt;
Enable Timer1&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' UDP&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Idx As Byte ' socket number&lt;br /&gt;
Dim Result As Word ' result&lt;br /&gt;
Dim S(255) As Byte&lt;br /&gt;
Dim R(255) As Byte&lt;br /&gt;
Dim Sstr As String * 255&lt;br /&gt;
Dim Temp As Byte , Temp2 As Byte ' temp bytes&lt;br /&gt;
Dim Ip As Long&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' PING NTP SERVER to check if NTP server is available&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
#if Use_ping = 1&lt;br /&gt;
 Dim J As Byte , Res As Byte&lt;br /&gt;
 Dim Ii As Byte&lt;br /&gt;
 Dim Ping_check_ok As Bit&lt;br /&gt;
&lt;br /&gt;
 ' FILL PING ARRAY&lt;br /&gt;
 S(1) = 8 'type is echo&lt;br /&gt;
 S(2) = 0 'code&lt;br /&gt;
&lt;br /&gt;
 S(3) = 0 ' for checksum initialization&lt;br /&gt;
 S(4) = 0 ' checksum&lt;br /&gt;
 S(5) = 0 ' a signature can be any number&lt;br /&gt;
 S(6) = 1 ' signature&lt;br /&gt;
 S(7) = 0 ' sequence number - any number&lt;br /&gt;
 S(8) = 1&lt;br /&gt;
 S(9) = 65&lt;br /&gt;
&lt;br /&gt;
 Dim W As Word At S + 2 Overlay 'same as dta(3) and dta(4)&lt;br /&gt;
 Dim B As Byte&lt;br /&gt;
 W = Tcpchecksum(s(1) , 9) ' calculate checksum and store in dta(3) and dta(4)&lt;br /&gt;
&lt;br /&gt;
 'Ip = Maketcp(192.53.103.108) 'try to check this google server&lt;br /&gt;
 Print &amp;quot;PING NTP Server : &amp;quot; ; Ip2str(ip_sntp_server)&lt;br /&gt;
&lt;br /&gt;
 'Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
 Setipprotocol Idx , 1 'set protocol to 1&lt;br /&gt;
 'the protocol value must be set BEFORE the socket is openend&lt;br /&gt;
&lt;br /&gt;
 Idx = Getsocket(idx , Sock_ipl_raw , 5000 , 0) 'RAW Socket&lt;br /&gt;
&lt;br /&gt;
 ' We try the PING 3 times (but if we get an answer we exit the for loop)&lt;br /&gt;
 Do&lt;br /&gt;
 Incr Ii&lt;br /&gt;
&lt;br /&gt;
 Result = Udpwrite(ip_sntp_server , 7 , Idx , S(1) , 9) 'write ping data '&lt;br /&gt;
 Print &amp;quot;Ping Number : &amp;quot; ; ii&lt;br /&gt;
 Waitms 200 ' depending on the hops, speed, etc&lt;br /&gt;
 Result = Socketstat(idx , Sel_recv) 'check for data&lt;br /&gt;
 ' Print &amp;quot;REC:&amp;quot; ; Result&lt;br /&gt;
 If Result &amp;gt;= 11 Then&lt;br /&gt;
&lt;br /&gt;
 Res = Tcpread(idx , R(1) , Result) 'get data with TCPREAD !!!&lt;br /&gt;
&lt;br /&gt;
 ' Print &amp;quot;DATA RETURNED :&amp;quot; ; Res&lt;br /&gt;
 '( '&lt;br /&gt;
 For J = 1 To Result&lt;br /&gt;
 Print R(j) ; &amp;quot; &amp;quot; ;&lt;br /&gt;
 Next&lt;br /&gt;
 Print&lt;br /&gt;
 ')&lt;br /&gt;
 Print &amp;quot;PING OK --&amp;gt; Exit Do..Loop&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 Set Ping_check_ok&lt;br /&gt;
&lt;br /&gt;
 Exit Do ' If we can an answer from NTP Server exit do ... loop&lt;br /&gt;
&lt;br /&gt;
 Else&lt;br /&gt;
 Print &amp;quot;NTP Server not available&amp;quot;&lt;br /&gt;
 End If&lt;br /&gt;
 Waitms 100&lt;br /&gt;
&lt;br /&gt;
 Loop Until Ii = 3&lt;br /&gt;
&lt;br /&gt;
 Ii = 0&lt;br /&gt;
#else&lt;br /&gt;
 Dim Ping_check_ok As Bit&lt;br /&gt;
 Ping_check_ok = 1&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' SNTP&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
If Ping_check_ok = 1 Then 'When the NTP Serverer responded to PING&lt;br /&gt;
 'we need to get a socket first&lt;br /&gt;
 'note that for UDP we specify sock_dgram&lt;br /&gt;
 Idx = Getsocket(idx , Sock_dgram , 1000 , 0) ' get socket for UDP mode, specify port&lt;br /&gt;
 Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
&lt;br /&gt;
 Local_time = Sntp(idx , Ip_sntp_server) ' get time from SNTP server&lt;br /&gt;
 Print &amp;quot;Local_time = &amp;quot; ; Local_time&lt;br /&gt;
&lt;br /&gt;
 If Local_time &amp;lt; 100 Then 'try it again&lt;br /&gt;
 Wait 1&lt;br /&gt;
 Local_time = Sntp(idx , Ip_sntp_server) ' get time from SNTP server&lt;br /&gt;
 Print &amp;quot;Second try ; Local_time = &amp;quot; ; Local_time&lt;br /&gt;
 End If&lt;br /&gt;
&lt;br /&gt;
 Local_time = Local_time + 3600 ' (UTC/GMT) time + 3600&lt;br /&gt;
 Print Date(local_time) ; Spc(3) ; Time(local_time)&lt;br /&gt;
End If&lt;br /&gt;
&lt;br /&gt;
'get a socket first&lt;br /&gt;
'note that for UDP we specify sock_dgram&lt;br /&gt;
Idx = Getsocket(idx , Sock_dgram , 1000 , 0) ' get socket for UDP mode, specify port&lt;br /&gt;
'Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Do&lt;br /&gt;
 If New_second = 1 Then&lt;br /&gt;
 Reset New_second&lt;br /&gt;
 'Do something every second ......&lt;br /&gt;
 End If&lt;br /&gt;
&lt;br /&gt;
 'The UDP header give us info about Peersize, Peerport and peeraddress&lt;br /&gt;
 'which is the amount of data bytes received from peerport and peer ip address&lt;br /&gt;
 Udpreadheader Idx ' read the udp header (only the first 8 Bytes)&lt;br /&gt;
&lt;br /&gt;
 If Peersize &amp;gt; 0 Then ' the actual number of bytes (without header bytes)&lt;br /&gt;
 Print &amp;quot;Size= &amp;quot; ; Peersize ; &amp;quot; By&amp;quot; ; &amp;quot; Port= &amp;quot; ; Peerport ; &amp;quot; Sender IP= &amp;quot; ; Ip2str(peeraddress) ; &amp;quot; Timestamp : &amp;quot; ; Date$ ; &amp;quot; / &amp;quot; ; Time$&lt;br /&gt;
 Temp = Udpread(idx , S(1) , Peersize) ' read the number of Bytes into Array S&lt;br /&gt;
 Print &amp;quot;DATA = &amp;quot; ;&lt;br /&gt;
 For Temp = 1 To Peersize&lt;br /&gt;
 Print Chr(s(temp)) ; ' print what we have received over USART to debug interface&lt;br /&gt;
 Next&lt;br /&gt;
 Print&lt;br /&gt;
 'Send it back to sender IP, Sender Port&lt;br /&gt;
 Result = Udpwrite(peeraddress , Peerport , Idx , S(1) , Peersize) ' write the received data back&lt;br /&gt;
 End If&lt;br /&gt;
Loop&lt;br /&gt;
&lt;br /&gt;
End&lt;br /&gt;
&lt;br /&gt;
Timer_irq:&lt;br /&gt;
 Incr Local_time&lt;br /&gt;
 Time$ = Time(local_time)&lt;br /&gt;
 Date$ = Date(local_time)&lt;br /&gt;
 Set New_second&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Getdatetime:&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Settime:&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Setdate:&lt;br /&gt;
Return&lt;br /&gt;
&amp;lt;/source&amp;gt;See Getting started with Arduino and WIZ820io [http://wiki.mcselec.com/Getting_started_with_Arduino_and_WIZ820io http://wiki.mcselec.com/Getting_started_with_Arduino_and_WIZ820io]&lt;br /&gt;
&lt;br /&gt;
to know how to use this example code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Terminal Output of example:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
When using Easy TCP/IP and sending the text &amp;quot;Hello&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
START Arduino UNO R3 + Ethernet Shield DEMO-----&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;PING NTP Server&amp;amp;nbsp;: 192.53.103.108&amp;lt;br/&amp;gt;Ping Number&amp;amp;nbsp;: 1&amp;lt;br/&amp;gt;PING OK --&amp;gt; Exit Do..Loop&amp;lt;br/&amp;gt;Socket 0 0&amp;lt;br/&amp;gt;Local_time = 416063775&amp;lt;br/&amp;gt;08.03.13&amp;amp;nbsp;&amp;amp;nbsp; 14:16:15&amp;lt;br/&amp;gt;Size= 5 By&amp;amp;nbsp; Port= 50000 Sender IP= 192.168.2.100&amp;amp;nbsp; Timestamp&amp;amp;nbsp;: 08.03.13 / 14:16:45&amp;lt;br/&amp;gt;DATA = Hello&lt;br /&gt;
&lt;br /&gt;
== Author&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
MAK3&lt;br /&gt;
&lt;br /&gt;
[[Category:Projects]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)</id>
		<title>Getting started with Arduino UNO R3 and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-09T08:21:58Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: /* Please read first this Article: */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Please read first this Article:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Getting started with Arduino and WIZ820io [http://wiki.mcselec.com/Getting_started_with_Arduino_and_WIZ820io http://wiki.mcselec.com/Getting_started_with_Arduino_and_WIZ820io]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It uses the same source code exept we use here an Wiznet W5100 Chip intead of W5200 so only '''config TCPIP '''needs to be changed.&lt;br /&gt;
&lt;br /&gt;
The usage of Easy TCP/IP in combination with that example is also the same.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The used Ethernet Shield is this here: [http://arduino.cc/en/Guide/ArduinoEthernetShield http://arduino.cc/en/Guide/ArduinoEthernetShield]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;Another difference is that in this example we do not use the Bascom-AVR bootloader. We use here the existing Arduino bootloader.&lt;br /&gt;
&lt;br /&gt;
To get started with this see here:&amp;amp;nbsp; [http://wiki.mcselec.com/Getting_started_with_Arduino_UNO http://wiki.mcselec.com/Getting_started_with_Arduino_UNO]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Arduino ethernet shield w5100.PNG|border|center|600x600px|Arduino ethernet shield w5100.PNG]]&lt;br /&gt;
&lt;br /&gt;
== Source Code:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The difference is only this part in the Bascom source code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
'Here you need MAC address, the ip address you like to use, subnet mask, gateway and localport&lt;br /&gt;
 Config Tcpip = Noint , _&lt;br /&gt;
 Mac = 1.1.94.127.1.255 , _&lt;br /&gt;
 Ip = 192.168.2.254 , _&lt;br /&gt;
 Submask = 255.255.255.0 , _&lt;br /&gt;
 Gateway = 192.168.2.1 , _&lt;br /&gt;
 Localport = 1000 , _&lt;br /&gt;
 Tx = $55 , Rx = $55 , _&lt;br /&gt;
 Chip = W5100 , _&lt;br /&gt;
 Spi = 1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Complete Source code:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
' IP Address of Arduino = 192.168.2.254&lt;br /&gt;
' Port of Arduino = 1000&lt;br /&gt;
' We use UDP&lt;br /&gt;
'&lt;br /&gt;
&lt;br /&gt;
'Use Hardware:&lt;br /&gt;
' - Arduino UNO R3&lt;br /&gt;
' - Arduino Ethernet Shield with W5100 Wiznet Chip&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
' NTP Server IP address (here you can change the NTP server of your choice)&lt;br /&gt;
Const Ntp1 = 192 : Const Ntp2 = 53 : Const Ntp3 = 103 : Const Ntp4 = 108 ' Example = 192.53.103.108&lt;br /&gt;
&lt;br /&gt;
Const Use_ping = 1 'use PING NTP server for checking NTP server availability before move on&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$regfile = &amp;quot;m328pdef.dat&amp;quot;&lt;br /&gt;
$crystal = 16000000 '16MHz&lt;br /&gt;
$hwstack = 100&lt;br /&gt;
$swstack = 100&lt;br /&gt;
$framesize = 400&lt;br /&gt;
&lt;br /&gt;
Config Com1 = 57600 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Server Variables&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Ip_sntp_server As Long&lt;br /&gt;
'assign the IP number of a SNTP server&lt;br /&gt;
Ip_sntp_server = Maketcp(ntp1 , Ntp2 , Ntp3 , Ntp4) 'assign IP of NTP SERVER&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Wait 2&lt;br /&gt;
Print&lt;br /&gt;
Print &amp;quot;-----START Arduino UNO R3 + Ethernet Shield DEMO-----&amp;quot;&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Network Hardware&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = Low , Phase = 0 , Clockrate = 4 , Noss = 0&lt;br /&gt;
Spiinit&lt;br /&gt;
&lt;br /&gt;
Print&lt;br /&gt;
Enable Interrupts&lt;br /&gt;
&lt;br /&gt;
 'Here you need MAC address, the ip address you like to use, subnet mask, gateway and localport&lt;br /&gt;
 Config Tcpip = Noint , _&lt;br /&gt;
 Mac = 1.1.94.127.1.255 , _&lt;br /&gt;
 Ip = 192.168.2.254 , _&lt;br /&gt;
 Submask = 255.255.255.0 , _&lt;br /&gt;
 Gateway = 192.168.2.1 , _&lt;br /&gt;
 Localport = 1000 , _&lt;br /&gt;
 Tx = $55 , Rx = $55 , _&lt;br /&gt;
 Chip = W5100 , _&lt;br /&gt;
 Spi = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Config Clock&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Local_time As Long&lt;br /&gt;
Dim New_second As Bit&lt;br /&gt;
&lt;br /&gt;
Config Date = Dmy , Separator = .&lt;br /&gt;
Config Clock = User&lt;br /&gt;
&lt;br /&gt;
Config Timer1 = Timer , Prescale = 256&lt;br /&gt;
On Timer1 Timer_irq Saveall 'the SAVEALL option is NEEDED !&lt;br /&gt;
Const Timer_preload = 3036&lt;br /&gt;
Enable Timer1&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' UDP&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Idx As Byte ' socket number&lt;br /&gt;
Dim Result As Word ' result&lt;br /&gt;
Dim S(255) As Byte&lt;br /&gt;
Dim R(255) As Byte&lt;br /&gt;
Dim Sstr As String * 255&lt;br /&gt;
Dim Temp As Byte , Temp2 As Byte ' temp bytes&lt;br /&gt;
Dim Ip As Long&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' PING NTP SERVER to check if NTP server is available&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
#if Use_ping = 1&lt;br /&gt;
 Dim J As Byte , Res As Byte&lt;br /&gt;
 Dim Ii As Byte&lt;br /&gt;
 Dim Ping_check_ok As Bit&lt;br /&gt;
&lt;br /&gt;
 ' FILL PING ARRAY&lt;br /&gt;
 S(1) = 8 'type is echo&lt;br /&gt;
 S(2) = 0 'code&lt;br /&gt;
&lt;br /&gt;
 S(3) = 0 ' for checksum initialization&lt;br /&gt;
 S(4) = 0 ' checksum&lt;br /&gt;
 S(5) = 0 ' a signature can be any number&lt;br /&gt;
 S(6) = 1 ' signature&lt;br /&gt;
 S(7) = 0 ' sequence number - any number&lt;br /&gt;
 S(8) = 1&lt;br /&gt;
 S(9) = 65&lt;br /&gt;
&lt;br /&gt;
 Dim W As Word At S + 2 Overlay 'same as dta(3) and dta(4)&lt;br /&gt;
 Dim B As Byte&lt;br /&gt;
 W = Tcpchecksum(s(1) , 9) ' calculate checksum and store in dta(3) and dta(4)&lt;br /&gt;
&lt;br /&gt;
 'Ip = Maketcp(192.53.103.108) 'try to check this google server&lt;br /&gt;
 Print &amp;quot;PING NTP Server : &amp;quot; ; Ip2str(ip_sntp_server)&lt;br /&gt;
&lt;br /&gt;
 'Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
 Setipprotocol Idx , 1 'set protocol to 1&lt;br /&gt;
 'the protocol value must be set BEFORE the socket is openend&lt;br /&gt;
&lt;br /&gt;
 Idx = Getsocket(idx , Sock_ipl_raw , 5000 , 0) 'RAW Socket&lt;br /&gt;
&lt;br /&gt;
 ' We try the PING 3 times (but if we get an answer we exit the for loop)&lt;br /&gt;
 Do&lt;br /&gt;
 Incr Ii&lt;br /&gt;
&lt;br /&gt;
 Result = Udpwrite(ip_sntp_server , 7 , Idx , S(1) , 9) 'write ping data '&lt;br /&gt;
 Print &amp;quot;Ping Number : &amp;quot; ; ii&lt;br /&gt;
 Waitms 200 ' depending on the hops, speed, etc&lt;br /&gt;
 Result = Socketstat(idx , Sel_recv) 'check for data&lt;br /&gt;
 ' Print &amp;quot;REC:&amp;quot; ; Result&lt;br /&gt;
 If Result &amp;gt;= 11 Then&lt;br /&gt;
&lt;br /&gt;
 Res = Tcpread(idx , R(1) , Result) 'get data with TCPREAD !!!&lt;br /&gt;
&lt;br /&gt;
 ' Print &amp;quot;DATA RETURNED :&amp;quot; ; Res&lt;br /&gt;
 '( '&lt;br /&gt;
 For J = 1 To Result&lt;br /&gt;
 Print R(j) ; &amp;quot; &amp;quot; ;&lt;br /&gt;
 Next&lt;br /&gt;
 Print&lt;br /&gt;
 ')&lt;br /&gt;
 Print &amp;quot;PING OK --&amp;gt; Exit Do..Loop&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 Set Ping_check_ok&lt;br /&gt;
&lt;br /&gt;
 Exit Do ' If we can an answer from NTP Server exit do ... loop&lt;br /&gt;
&lt;br /&gt;
 Else&lt;br /&gt;
 Print &amp;quot;NTP Server not available&amp;quot;&lt;br /&gt;
 End If&lt;br /&gt;
 Waitms 100&lt;br /&gt;
&lt;br /&gt;
 Loop Until Ii = 3&lt;br /&gt;
&lt;br /&gt;
 Ii = 0&lt;br /&gt;
#else&lt;br /&gt;
 Dim Ping_check_ok As Bit&lt;br /&gt;
 Ping_check_ok = 1&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' SNTP&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
If Ping_check_ok = 1 Then 'When the NTP Serverer responded to PING&lt;br /&gt;
 'we need to get a socket first&lt;br /&gt;
 'note that for UDP we specify sock_dgram&lt;br /&gt;
 Idx = Getsocket(idx , Sock_dgram , 1000 , 0) ' get socket for UDP mode, specify port&lt;br /&gt;
 Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
&lt;br /&gt;
 Local_time = Sntp(idx , Ip_sntp_server) ' get time from SNTP server&lt;br /&gt;
 Print &amp;quot;Local_time = &amp;quot; ; Local_time&lt;br /&gt;
&lt;br /&gt;
 If Local_time &amp;lt; 100 Then 'try it again&lt;br /&gt;
 Wait 1&lt;br /&gt;
 Local_time = Sntp(idx , Ip_sntp_server) ' get time from SNTP server&lt;br /&gt;
 Print &amp;quot;Second try ; Local_time = &amp;quot; ; Local_time&lt;br /&gt;
 End If&lt;br /&gt;
&lt;br /&gt;
 Local_time = Local_time + 3600 ' (UTC/GMT) time + 3600&lt;br /&gt;
 Print Date(local_time) ; Spc(3) ; Time(local_time)&lt;br /&gt;
End If&lt;br /&gt;
&lt;br /&gt;
'get a socket first&lt;br /&gt;
'note that for UDP we specify sock_dgram&lt;br /&gt;
Idx = Getsocket(idx , Sock_dgram , 1000 , 0) ' get socket for UDP mode, specify port&lt;br /&gt;
'Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Do&lt;br /&gt;
 If New_second = 1 Then&lt;br /&gt;
 Reset New_second&lt;br /&gt;
 'Do something every second ......&lt;br /&gt;
 End If&lt;br /&gt;
&lt;br /&gt;
 'The UDP header give us info about Peersize, Peerport and peeraddress&lt;br /&gt;
 'which is the amount of data bytes received from peerport and peer ip address&lt;br /&gt;
 Udpreadheader Idx ' read the udp header (only the first 8 Bytes)&lt;br /&gt;
&lt;br /&gt;
 If Peersize &amp;gt; 0 Then ' the actual number of bytes (without header bytes)&lt;br /&gt;
 Print &amp;quot;Size= &amp;quot; ; Peersize ; &amp;quot; By&amp;quot; ; &amp;quot; Port= &amp;quot; ; Peerport ; &amp;quot; Sender IP= &amp;quot; ; Ip2str(peeraddress) ; &amp;quot; Timestamp : &amp;quot; ; Date$ ; &amp;quot; / &amp;quot; ; Time$&lt;br /&gt;
 Temp = Udpread(idx , S(1) , Peersize) ' read the number of Bytes into Array S&lt;br /&gt;
 Print &amp;quot;DATA = &amp;quot; ;&lt;br /&gt;
 For Temp = 1 To Peersize&lt;br /&gt;
 Print Chr(s(temp)) ; ' print what we have received over USART to debug interface&lt;br /&gt;
 Next&lt;br /&gt;
 Print&lt;br /&gt;
 'Send it back to sender IP, Sender Port&lt;br /&gt;
 Result = Udpwrite(peeraddress , Peerport , Idx , S(1) , Peersize) ' write the received data back&lt;br /&gt;
 End If&lt;br /&gt;
Loop&lt;br /&gt;
&lt;br /&gt;
End&lt;br /&gt;
&lt;br /&gt;
Timer_irq:&lt;br /&gt;
 Incr Local_time&lt;br /&gt;
 Time$ = Time(local_time)&lt;br /&gt;
 Date$ = Date(local_time)&lt;br /&gt;
 Set New_second&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Getdatetime:&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Settime:&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Setdate:&lt;br /&gt;
Return&lt;br /&gt;
&amp;lt;/source&amp;gt;See Getting started with Arduino and WIZ820io [http://wiki.mcselec.com/Getting_started_with_Arduino_and_WIZ820io http://wiki.mcselec.com/Getting_started_with_Arduino_and_WIZ820io]&lt;br /&gt;
&lt;br /&gt;
to know how to use this example code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Terminal Output of example:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
When using Easy TCP/IP and sending the text &amp;quot;Hello&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
START Arduino UNO R3 + Ethernet Shield DEMO-----&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;PING NTP Server&amp;amp;nbsp;: 192.53.103.108&amp;lt;br/&amp;gt;Ping Number&amp;amp;nbsp;: 1&amp;lt;br/&amp;gt;PING OK --&amp;gt; Exit Do..Loop&amp;lt;br/&amp;gt;Socket 0 0&amp;lt;br/&amp;gt;Local_time = 416063775&amp;lt;br/&amp;gt;08.03.13&amp;amp;nbsp;&amp;amp;nbsp; 14:16:15&amp;lt;br/&amp;gt;Size= 5 By&amp;amp;nbsp; Port= 50000 Sender IP= 192.168.2.100&amp;amp;nbsp; Timestamp&amp;amp;nbsp;: 08.03.13 / 14:16:45&amp;lt;br/&amp;gt;DATA = Hello&lt;br /&gt;
&lt;br /&gt;
== Author&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
MAK3&lt;br /&gt;
&lt;br /&gt;
[[Category:Projects]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)</id>
		<title>Getting started with Arduino UNO R3 and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-08T13:56:30Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Please read first this Article:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Getting started with Arduino and WIZ820io [http://wiki.mcselec.com/Getting_started_with_Arduino_and_WIZ820io http://wiki.mcselec.com/Getting_started_with_Arduino_and_WIZ820io]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It uses the same source code exept we use here an Wiznet W5100 Chip intead of W5200 so only '''config TCPIP '''needs to be changed.&lt;br /&gt;
&lt;br /&gt;
The usage of Easy TCP/IP in combination with that example is also the same.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another difference is that in this example we do not use the Bascom-AVR bootloader. We use here the existing Arduino bootloader.&lt;br /&gt;
&lt;br /&gt;
To get started with this see here:&amp;amp;nbsp; [http://wiki.mcselec.com/Getting_started_with_Arduino_UNO http://wiki.mcselec.com/Getting_started_with_Arduino_UNO]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Arduino ethernet shield w5100.PNG|border|center|600x600px]]&lt;br /&gt;
&lt;br /&gt;
== Source Code:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The difference is only this part in the Bascom source code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
'Here you need MAC address, the ip address you like to use, subnet mask, gateway and localport&lt;br /&gt;
 Config Tcpip = Noint , _&lt;br /&gt;
 Mac = 1.1.94.127.1.255 , _&lt;br /&gt;
 Ip = 192.168.2.254 , _&lt;br /&gt;
 Submask = 255.255.255.0 , _&lt;br /&gt;
 Gateway = 192.168.2.1 , _&lt;br /&gt;
 Localport = 1000 , _&lt;br /&gt;
 Tx = $55 , Rx = $55 , _&lt;br /&gt;
 Chip = W5100 , _&lt;br /&gt;
 Spi = 1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Complete Source code:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
' IP Address of Arduino = 192.168.2.254&lt;br /&gt;
' Port of Arduino = 1000&lt;br /&gt;
' We use UDP&lt;br /&gt;
'&lt;br /&gt;
&lt;br /&gt;
'Use Hardware:&lt;br /&gt;
' - Arduino UNO R3&lt;br /&gt;
' - Arduino Ethernet Shield with W5100 Wiznet Chip&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
' NTP Server IP address (here you can change the NTP server of your choice)&lt;br /&gt;
Const Ntp1 = 192 : Const Ntp2 = 53 : Const Ntp3 = 103 : Const Ntp4 = 108 ' Example = 192.53.103.108&lt;br /&gt;
&lt;br /&gt;
Const Use_ping = 1 'use PING NTP server for checking NTP server availability before move on&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$regfile = &amp;quot;m328pdef.dat&amp;quot;&lt;br /&gt;
$crystal = 16000000 '16MHz&lt;br /&gt;
$hwstack = 100&lt;br /&gt;
$swstack = 100&lt;br /&gt;
$framesize = 400&lt;br /&gt;
&lt;br /&gt;
Config Com1 = 57600 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Server Variables&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Ip_sntp_server As Long&lt;br /&gt;
'assign the IP number of a SNTP server&lt;br /&gt;
Ip_sntp_server = Maketcp(ntp1 , Ntp2 , Ntp3 , Ntp4) 'assign IP of NTP SERVER&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Wait 2&lt;br /&gt;
Print&lt;br /&gt;
Print &amp;quot;-----START Arduino UNO R3 + Ethernet Shield DEMO-----&amp;quot;&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Network Hardware&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = Low , Phase = 0 , Clockrate = 4 , Noss = 0&lt;br /&gt;
Spiinit&lt;br /&gt;
&lt;br /&gt;
Print&lt;br /&gt;
Enable Interrupts&lt;br /&gt;
&lt;br /&gt;
 'Here you need MAC address, the ip address you like to use, subnet mask, gateway and localport&lt;br /&gt;
 Config Tcpip = Noint , _&lt;br /&gt;
 Mac = 1.1.94.127.1.255 , _&lt;br /&gt;
 Ip = 192.168.2.254 , _&lt;br /&gt;
 Submask = 255.255.255.0 , _&lt;br /&gt;
 Gateway = 192.168.2.1 , _&lt;br /&gt;
 Localport = 1000 , _&lt;br /&gt;
 Tx = $55 , Rx = $55 , _&lt;br /&gt;
 Chip = W5100 , _&lt;br /&gt;
 Spi = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Config Clock&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Local_time As Long&lt;br /&gt;
Dim New_second As Bit&lt;br /&gt;
&lt;br /&gt;
Config Date = Dmy , Separator = .&lt;br /&gt;
Config Clock = User&lt;br /&gt;
&lt;br /&gt;
Config Timer1 = Timer , Prescale = 256&lt;br /&gt;
On Timer1 Timer_irq Saveall 'the SAVEALL option is NEEDED !&lt;br /&gt;
Const Timer_preload = 3036&lt;br /&gt;
Enable Timer1&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' UDP&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Idx As Byte ' socket number&lt;br /&gt;
Dim Result As Word ' result&lt;br /&gt;
Dim S(255) As Byte&lt;br /&gt;
Dim R(255) As Byte&lt;br /&gt;
Dim Sstr As String * 255&lt;br /&gt;
Dim Temp As Byte , Temp2 As Byte ' temp bytes&lt;br /&gt;
Dim Ip As Long&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' PING NTP SERVER to check if NTP server is available&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
#if Use_ping = 1&lt;br /&gt;
 Dim J As Byte , Res As Byte&lt;br /&gt;
 Dim Ii As Byte&lt;br /&gt;
 Dim Ping_check_ok As Bit&lt;br /&gt;
&lt;br /&gt;
 ' FILL PING ARRAY&lt;br /&gt;
 S(1) = 8 'type is echo&lt;br /&gt;
 S(2) = 0 'code&lt;br /&gt;
&lt;br /&gt;
 S(3) = 0 ' for checksum initialization&lt;br /&gt;
 S(4) = 0 ' checksum&lt;br /&gt;
 S(5) = 0 ' a signature can be any number&lt;br /&gt;
 S(6) = 1 ' signature&lt;br /&gt;
 S(7) = 0 ' sequence number - any number&lt;br /&gt;
 S(8) = 1&lt;br /&gt;
 S(9) = 65&lt;br /&gt;
&lt;br /&gt;
 Dim W As Word At S + 2 Overlay 'same as dta(3) and dta(4)&lt;br /&gt;
 Dim B As Byte&lt;br /&gt;
 W = Tcpchecksum(s(1) , 9) ' calculate checksum and store in dta(3) and dta(4)&lt;br /&gt;
&lt;br /&gt;
 'Ip = Maketcp(192.53.103.108) 'try to check this google server&lt;br /&gt;
 Print &amp;quot;PING NTP Server : &amp;quot; ; Ip2str(ip_sntp_server)&lt;br /&gt;
&lt;br /&gt;
 'Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
 Setipprotocol Idx , 1 'set protocol to 1&lt;br /&gt;
 'the protocol value must be set BEFORE the socket is openend&lt;br /&gt;
&lt;br /&gt;
 Idx = Getsocket(idx , Sock_ipl_raw , 5000 , 0) 'RAW Socket&lt;br /&gt;
&lt;br /&gt;
 ' We try the PING 3 times (but if we get an answer we exit the for loop)&lt;br /&gt;
 Do&lt;br /&gt;
 Incr Ii&lt;br /&gt;
&lt;br /&gt;
 Result = Udpwrite(ip_sntp_server , 7 , Idx , S(1) , 9) 'write ping data '&lt;br /&gt;
 Print &amp;quot;Ping Number : &amp;quot; ; ii&lt;br /&gt;
 Waitms 200 ' depending on the hops, speed, etc&lt;br /&gt;
 Result = Socketstat(idx , Sel_recv) 'check for data&lt;br /&gt;
 ' Print &amp;quot;REC:&amp;quot; ; Result&lt;br /&gt;
 If Result &amp;gt;= 11 Then&lt;br /&gt;
&lt;br /&gt;
 Res = Tcpread(idx , R(1) , Result) 'get data with TCPREAD !!!&lt;br /&gt;
&lt;br /&gt;
 ' Print &amp;quot;DATA RETURNED :&amp;quot; ; Res&lt;br /&gt;
 '( '&lt;br /&gt;
 For J = 1 To Result&lt;br /&gt;
 Print R(j) ; &amp;quot; &amp;quot; ;&lt;br /&gt;
 Next&lt;br /&gt;
 Print&lt;br /&gt;
 ')&lt;br /&gt;
 Print &amp;quot;PING OK --&amp;gt; Exit Do..Loop&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 Set Ping_check_ok&lt;br /&gt;
&lt;br /&gt;
 Exit Do ' If we can an answer from NTP Server exit do ... loop&lt;br /&gt;
&lt;br /&gt;
 Else&lt;br /&gt;
 Print &amp;quot;NTP Server not available&amp;quot;&lt;br /&gt;
 End If&lt;br /&gt;
 Waitms 100&lt;br /&gt;
&lt;br /&gt;
 Loop Until Ii = 3&lt;br /&gt;
&lt;br /&gt;
 Ii = 0&lt;br /&gt;
#else&lt;br /&gt;
 Dim Ping_check_ok As Bit&lt;br /&gt;
 Ping_check_ok = 1&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' SNTP&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
If Ping_check_ok = 1 Then 'When the NTP Serverer responded to PING&lt;br /&gt;
 'we need to get a socket first&lt;br /&gt;
 'note that for UDP we specify sock_dgram&lt;br /&gt;
 Idx = Getsocket(idx , Sock_dgram , 1000 , 0) ' get socket for UDP mode, specify port&lt;br /&gt;
 Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
&lt;br /&gt;
 Local_time = Sntp(idx , Ip_sntp_server) ' get time from SNTP server&lt;br /&gt;
 Print &amp;quot;Local_time = &amp;quot; ; Local_time&lt;br /&gt;
&lt;br /&gt;
 If Local_time &amp;lt; 100 Then 'try it again&lt;br /&gt;
 Wait 1&lt;br /&gt;
 Local_time = Sntp(idx , Ip_sntp_server) ' get time from SNTP server&lt;br /&gt;
 Print &amp;quot;Second try ; Local_time = &amp;quot; ; Local_time&lt;br /&gt;
 End If&lt;br /&gt;
&lt;br /&gt;
 Local_time = Local_time + 3600 ' (UTC/GMT) time + 3600&lt;br /&gt;
 Print Date(local_time) ; Spc(3) ; Time(local_time)&lt;br /&gt;
End If&lt;br /&gt;
&lt;br /&gt;
'get a socket first&lt;br /&gt;
'note that for UDP we specify sock_dgram&lt;br /&gt;
Idx = Getsocket(idx , Sock_dgram , 1000 , 0) ' get socket for UDP mode, specify port&lt;br /&gt;
'Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Do&lt;br /&gt;
 If New_second = 1 Then&lt;br /&gt;
 Reset New_second&lt;br /&gt;
 'Do something every second ......&lt;br /&gt;
 End If&lt;br /&gt;
&lt;br /&gt;
 'The UDP header give us info about Peersize, Peerport and peeraddress&lt;br /&gt;
 'which is the amount of data bytes received from peerport and peer ip address&lt;br /&gt;
 Udpreadheader Idx ' read the udp header (only the first 8 Bytes)&lt;br /&gt;
&lt;br /&gt;
 If Peersize &amp;gt; 0 Then ' the actual number of bytes (without header bytes)&lt;br /&gt;
 Print &amp;quot;Size= &amp;quot; ; Peersize ; &amp;quot; By&amp;quot; ; &amp;quot; Port= &amp;quot; ; Peerport ; &amp;quot; Sender IP= &amp;quot; ; Ip2str(peeraddress) ; &amp;quot; Timestamp : &amp;quot; ; Date$ ; &amp;quot; / &amp;quot; ; Time$&lt;br /&gt;
 Temp = Udpread(idx , S(1) , Peersize) ' read the number of Bytes into Array S&lt;br /&gt;
 Print &amp;quot;DATA = &amp;quot; ;&lt;br /&gt;
 For Temp = 1 To Peersize&lt;br /&gt;
 Print Chr(s(temp)) ; ' print what we have received over USART to debug interface&lt;br /&gt;
 Next&lt;br /&gt;
 Print&lt;br /&gt;
 'Send it back to sender IP, Sender Port&lt;br /&gt;
 Result = Udpwrite(peeraddress , Peerport , Idx , S(1) , Peersize) ' write the received data back&lt;br /&gt;
 End If&lt;br /&gt;
Loop&lt;br /&gt;
&lt;br /&gt;
End&lt;br /&gt;
&lt;br /&gt;
Timer_irq:&lt;br /&gt;
 Incr Local_time&lt;br /&gt;
 Time$ = Time(local_time)&lt;br /&gt;
 Date$ = Date(local_time)&lt;br /&gt;
 Set New_second&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Getdatetime:&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Settime:&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Setdate:&lt;br /&gt;
Return&lt;br /&gt;
&amp;lt;/source&amp;gt;See Getting started with Arduino and WIZ820io [http://wiki.mcselec.com/Getting_started_with_Arduino_and_WIZ820io http://wiki.mcselec.com/Getting_started_with_Arduino_and_WIZ820io]&lt;br /&gt;
&lt;br /&gt;
to know how to use this example code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Terminal Output of example:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
When using Easy TCP/IP and sending the text &amp;quot;Hello&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
START Arduino UNO R3 + Ethernet Shield DEMO-----&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;PING NTP Server&amp;amp;nbsp;: 192.53.103.108&amp;lt;br/&amp;gt;Ping Number&amp;amp;nbsp;: 1&amp;lt;br/&amp;gt;PING OK --&amp;gt; Exit Do..Loop&amp;lt;br/&amp;gt;Socket 0 0&amp;lt;br/&amp;gt;Local_time = 416063775&amp;lt;br/&amp;gt;08.03.13&amp;amp;nbsp;&amp;amp;nbsp; 14:16:15&amp;lt;br/&amp;gt;Size= 5 By&amp;amp;nbsp; Port= 50000 Sender IP= 192.168.2.100&amp;amp;nbsp; Timestamp&amp;amp;nbsp;: 08.03.13 / 14:16:45&amp;lt;br/&amp;gt;DATA = Hello&lt;br /&gt;
&lt;br /&gt;
== Author&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
MAK3&lt;br /&gt;
&lt;br /&gt;
[[Category:Projects]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/File:Arduino_ethernet_shield_w5100.PNG</id>
		<title>File:Arduino ethernet shield w5100.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/File:Arduino_ethernet_shield_w5100.PNG"/>
				<updated>2013-03-08T13:55:39Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)</id>
		<title>Getting started with Arduino UNO R3 and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-08T13:37:33Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Please read first this Article:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Getting started with Arduino and WIZ820io [http://wiki.mcselec.com/Getting_started_with_Arduino_and_WIZ820io http://wiki.mcselec.com/Getting_started_with_Arduino_and_WIZ820io]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It uses the same source code exept we use here an Wiznet W5100 Chip intead of W5200 so only '''config TCPIP '''needs to be changed.&lt;br /&gt;
&lt;br /&gt;
The usage of Easy TCP/IP in combination with that example is also the same.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another difference is that in this example we do not use the Bascom-AVR bootloader. We use here the existing Arduino bootloader.&lt;br /&gt;
&lt;br /&gt;
To get started with this see here:&amp;amp;nbsp; [http://wiki.mcselec.com/Getting_started_with_Arduino_UNO http://wiki.mcselec.com/Getting_started_with_Arduino_UNO]&lt;br /&gt;
&lt;br /&gt;
== Source Code:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The difference is only this part in the Bascom source code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
'Here you need MAC address, the ip address you like to use, subnet mask, gateway and localport&lt;br /&gt;
 Config Tcpip = Noint , _&lt;br /&gt;
 Mac = 1.1.94.127.1.255 , _&lt;br /&gt;
 Ip = 192.168.2.254 , _&lt;br /&gt;
 Submask = 255.255.255.0 , _&lt;br /&gt;
 Gateway = 192.168.2.1 , _&lt;br /&gt;
 Localport = 1000 , _&lt;br /&gt;
 Tx = $55 , Rx = $55 , _&lt;br /&gt;
 Chip = W5100 , _&lt;br /&gt;
 Spi = 1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Complete Source code:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
' IP Address of Arduino = 192.168.2.254&lt;br /&gt;
' Port of Arduino = 1000&lt;br /&gt;
' We use UDP&lt;br /&gt;
'&lt;br /&gt;
&lt;br /&gt;
'Use Hardware:&lt;br /&gt;
' - Arduino UNO R3&lt;br /&gt;
' - Arduino Ethernet Shield with W5100 Wiznet Chip&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
' NTP Server IP address (here you can change the NTP server of your choice)&lt;br /&gt;
Const Ntp1 = 192 : Const Ntp2 = 53 : Const Ntp3 = 103 : Const Ntp4 = 108 ' Example = 192.53.103.108&lt;br /&gt;
&lt;br /&gt;
Const Use_ping = 1 'use PING NTP server for checking NTP server availability before move on&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$regfile = &amp;quot;m328pdef.dat&amp;quot;&lt;br /&gt;
$crystal = 16000000 '16MHz&lt;br /&gt;
$hwstack = 100&lt;br /&gt;
$swstack = 100&lt;br /&gt;
$framesize = 400&lt;br /&gt;
&lt;br /&gt;
Config Com1 = 57600 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Server Variables&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Ip_sntp_server As Long&lt;br /&gt;
'assign the IP number of a SNTP server&lt;br /&gt;
Ip_sntp_server = Maketcp(ntp1 , Ntp2 , Ntp3 , Ntp4) 'assign IP of NTP SERVER&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Wait 2&lt;br /&gt;
Print&lt;br /&gt;
Print &amp;quot;-----START Arduino UNO R3 + Ethernet Shield DEMO-----&amp;quot;&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Network Hardware&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = Low , Phase = 0 , Clockrate = 4 , Noss = 0&lt;br /&gt;
Spiinit&lt;br /&gt;
&lt;br /&gt;
Print&lt;br /&gt;
Enable Interrupts&lt;br /&gt;
&lt;br /&gt;
 'Here you need MAC address, the ip address you like to use, subnet mask, gateway and localport&lt;br /&gt;
 Config Tcpip = Noint , _&lt;br /&gt;
 Mac = 1.1.94.127.1.255 , _&lt;br /&gt;
 Ip = 192.168.2.254 , _&lt;br /&gt;
 Submask = 255.255.255.0 , _&lt;br /&gt;
 Gateway = 192.168.2.1 , _&lt;br /&gt;
 Localport = 1000 , _&lt;br /&gt;
 Tx = $55 , Rx = $55 , _&lt;br /&gt;
 Chip = W5100 , _&lt;br /&gt;
 Spi = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Config Clock&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Local_time As Long&lt;br /&gt;
Dim New_second As Bit&lt;br /&gt;
&lt;br /&gt;
Config Date = Dmy , Separator = .&lt;br /&gt;
Config Clock = User&lt;br /&gt;
&lt;br /&gt;
Config Timer1 = Timer , Prescale = 256&lt;br /&gt;
On Timer1 Timer_irq Saveall 'the SAVEALL option is NEEDED !&lt;br /&gt;
Const Timer_preload = 3036&lt;br /&gt;
Enable Timer1&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' UDP&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Idx As Byte ' socket number&lt;br /&gt;
Dim Result As Word ' result&lt;br /&gt;
Dim S(255) As Byte&lt;br /&gt;
Dim R(255) As Byte&lt;br /&gt;
Dim Sstr As String * 255&lt;br /&gt;
Dim Temp As Byte , Temp2 As Byte ' temp bytes&lt;br /&gt;
Dim Ip As Long&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' PING NTP SERVER to check if NTP server is available&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
#if Use_ping = 1&lt;br /&gt;
 Dim J As Byte , Res As Byte&lt;br /&gt;
 Dim Ii As Byte&lt;br /&gt;
 Dim Ping_check_ok As Bit&lt;br /&gt;
&lt;br /&gt;
 ' FILL PING ARRAY&lt;br /&gt;
 S(1) = 8 'type is echo&lt;br /&gt;
 S(2) = 0 'code&lt;br /&gt;
&lt;br /&gt;
 S(3) = 0 ' for checksum initialization&lt;br /&gt;
 S(4) = 0 ' checksum&lt;br /&gt;
 S(5) = 0 ' a signature can be any number&lt;br /&gt;
 S(6) = 1 ' signature&lt;br /&gt;
 S(7) = 0 ' sequence number - any number&lt;br /&gt;
 S(8) = 1&lt;br /&gt;
 S(9) = 65&lt;br /&gt;
&lt;br /&gt;
 Dim W As Word At S + 2 Overlay 'same as dta(3) and dta(4)&lt;br /&gt;
 Dim B As Byte&lt;br /&gt;
 W = Tcpchecksum(s(1) , 9) ' calculate checksum and store in dta(3) and dta(4)&lt;br /&gt;
&lt;br /&gt;
 'Ip = Maketcp(192.53.103.108) 'try to check this google server&lt;br /&gt;
 Print &amp;quot;PING NTP Server : &amp;quot; ; Ip2str(ip_sntp_server)&lt;br /&gt;
&lt;br /&gt;
 'Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
 Setipprotocol Idx , 1 'set protocol to 1&lt;br /&gt;
 'the protocol value must be set BEFORE the socket is openend&lt;br /&gt;
&lt;br /&gt;
 Idx = Getsocket(idx , Sock_ipl_raw , 5000 , 0) 'RAW Socket&lt;br /&gt;
&lt;br /&gt;
 ' We try the PING 3 times (but if we get an answer we exit the for loop)&lt;br /&gt;
 Do&lt;br /&gt;
 Incr Ii&lt;br /&gt;
&lt;br /&gt;
 Result = Udpwrite(ip_sntp_server , 7 , Idx , S(1) , 9) 'write ping data '&lt;br /&gt;
 Print &amp;quot;Ping Number : &amp;quot; ; ii&lt;br /&gt;
 Waitms 200 ' depending on the hops, speed, etc&lt;br /&gt;
 Result = Socketstat(idx , Sel_recv) 'check for data&lt;br /&gt;
 ' Print &amp;quot;REC:&amp;quot; ; Result&lt;br /&gt;
 If Result &amp;gt;= 11 Then&lt;br /&gt;
&lt;br /&gt;
 Res = Tcpread(idx , R(1) , Result) 'get data with TCPREAD !!!&lt;br /&gt;
&lt;br /&gt;
 ' Print &amp;quot;DATA RETURNED :&amp;quot; ; Res&lt;br /&gt;
 '( '&lt;br /&gt;
 For J = 1 To Result&lt;br /&gt;
 Print R(j) ; &amp;quot; &amp;quot; ;&lt;br /&gt;
 Next&lt;br /&gt;
 Print&lt;br /&gt;
 ')&lt;br /&gt;
 Print &amp;quot;PING OK --&amp;gt; Exit Do..Loop&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 Set Ping_check_ok&lt;br /&gt;
&lt;br /&gt;
 Exit Do ' If we can an answer from NTP Server exit do ... loop&lt;br /&gt;
&lt;br /&gt;
 Else&lt;br /&gt;
 Print &amp;quot;NTP Server not available&amp;quot;&lt;br /&gt;
 End If&lt;br /&gt;
 Waitms 100&lt;br /&gt;
&lt;br /&gt;
 Loop Until Ii = 3&lt;br /&gt;
&lt;br /&gt;
 Ii = 0&lt;br /&gt;
#else&lt;br /&gt;
 Dim Ping_check_ok As Bit&lt;br /&gt;
 Ping_check_ok = 1&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' SNTP&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
If Ping_check_ok = 1 Then 'When the NTP Serverer responded to PING&lt;br /&gt;
 'we need to get a socket first&lt;br /&gt;
 'note that for UDP we specify sock_dgram&lt;br /&gt;
 Idx = Getsocket(idx , Sock_dgram , 1000 , 0) ' get socket for UDP mode, specify port&lt;br /&gt;
 Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
&lt;br /&gt;
 Local_time = Sntp(idx , Ip_sntp_server) ' get time from SNTP server&lt;br /&gt;
 Print &amp;quot;Local_time = &amp;quot; ; Local_time&lt;br /&gt;
&lt;br /&gt;
 If Local_time &amp;lt; 100 Then 'try it again&lt;br /&gt;
 Wait 1&lt;br /&gt;
 Local_time = Sntp(idx , Ip_sntp_server) ' get time from SNTP server&lt;br /&gt;
 Print &amp;quot;Second try ; Local_time = &amp;quot; ; Local_time&lt;br /&gt;
 End If&lt;br /&gt;
&lt;br /&gt;
 Local_time = Local_time + 3600 ' (UTC/GMT) time + 3600&lt;br /&gt;
 Print Date(local_time) ; Spc(3) ; Time(local_time)&lt;br /&gt;
End If&lt;br /&gt;
&lt;br /&gt;
'get a socket first&lt;br /&gt;
'note that for UDP we specify sock_dgram&lt;br /&gt;
Idx = Getsocket(idx , Sock_dgram , 1000 , 0) ' get socket for UDP mode, specify port&lt;br /&gt;
'Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Do&lt;br /&gt;
 If New_second = 1 Then&lt;br /&gt;
 Reset New_second&lt;br /&gt;
 'Do something every second ......&lt;br /&gt;
 End If&lt;br /&gt;
&lt;br /&gt;
 'The UDP header give us info about Peersize, Peerport and peeraddress&lt;br /&gt;
 'which is the amount of data bytes received from peerport and peer ip address&lt;br /&gt;
 Udpreadheader Idx ' read the udp header (only the first 8 Bytes)&lt;br /&gt;
&lt;br /&gt;
 If Peersize &amp;gt; 0 Then ' the actual number of bytes (without header bytes)&lt;br /&gt;
 Print &amp;quot;Size= &amp;quot; ; Peersize ; &amp;quot; By&amp;quot; ; &amp;quot; Port= &amp;quot; ; Peerport ; &amp;quot; Sender IP= &amp;quot; ; Ip2str(peeraddress) ; &amp;quot; Timestamp : &amp;quot; ; Date$ ; &amp;quot; / &amp;quot; ; Time$&lt;br /&gt;
 Temp = Udpread(idx , S(1) , Peersize) ' read the number of Bytes into Array S&lt;br /&gt;
 Print &amp;quot;DATA = &amp;quot; ;&lt;br /&gt;
 For Temp = 1 To Peersize&lt;br /&gt;
 Print Chr(s(temp)) ; ' print what we have received over USART to debug interface&lt;br /&gt;
 Next&lt;br /&gt;
 Print&lt;br /&gt;
 'Send it back to sender IP, Sender Port&lt;br /&gt;
 Result = Udpwrite(peeraddress , Peerport , Idx , S(1) , Peersize) ' write the received data back&lt;br /&gt;
 End If&lt;br /&gt;
Loop&lt;br /&gt;
&lt;br /&gt;
End&lt;br /&gt;
&lt;br /&gt;
Timer_irq:&lt;br /&gt;
 Incr Local_time&lt;br /&gt;
 Time$ = Time(local_time)&lt;br /&gt;
 Date$ = Date(local_time)&lt;br /&gt;
 Set New_second&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Getdatetime:&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Settime:&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Setdate:&lt;br /&gt;
Return&lt;br /&gt;
&amp;lt;/source&amp;gt;See Getting started with Arduino and WIZ820io [http://wiki.mcselec.com/Getting_started_with_Arduino_and_WIZ820io http://wiki.mcselec.com/Getting_started_with_Arduino_and_WIZ820io]&lt;br /&gt;
&lt;br /&gt;
to know how to use this example code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Terminal Output of example:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
When using Easy TCP/IP and sending the text &amp;quot;Hello&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
START Arduino UNO R3 + Ethernet Shield DEMO-----&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;PING NTP Server&amp;amp;nbsp;: 192.53.103.108&amp;lt;br/&amp;gt;Ping Number&amp;amp;nbsp;: 1&amp;lt;br/&amp;gt;PING OK --&amp;gt; Exit Do..Loop&amp;lt;br/&amp;gt;Socket 0 0&amp;lt;br/&amp;gt;Local_time = 416063775&amp;lt;br/&amp;gt;08.03.13&amp;amp;nbsp;&amp;amp;nbsp; 14:16:15&amp;lt;br/&amp;gt;Size= 5 By&amp;amp;nbsp; Port= 50000 Sender IP= 192.168.2.100&amp;amp;nbsp; Timestamp&amp;amp;nbsp;: 08.03.13 / 14:16:45&amp;lt;br/&amp;gt;DATA = Hello&lt;br /&gt;
&lt;br /&gt;
== Author&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
MAK3&lt;br /&gt;
&lt;br /&gt;
[[Category:Projects]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)</id>
		<title>Getting started with Arduino UNO R3 and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-08T13:36:14Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Please read first this Article:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Getting started with Arduino and WIZ820io [http://wiki.mcselec.com/Getting_started_with_Arduino_and_WIZ820io http://wiki.mcselec.com/Getting_started_with_Arduino_and_WIZ820io]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It uses the same source code exept we use here an Wiznet W5100 Chip intead of W5200 so only '''config TCPIP '''needs to be changed.&lt;br /&gt;
&lt;br /&gt;
The usage of Easy TCP/IP in combination with that example is also the same.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another difference is that in this example we do not use the Bascom-AVR bootloader. We use here the existing Arduino bootloader.&lt;br /&gt;
&lt;br /&gt;
To get started with this see here:&amp;amp;nbsp; [http://wiki.mcselec.com/Getting_started_with_Arduino_UNO http://wiki.mcselec.com/Getting_started_with_Arduino_UNO]&lt;br /&gt;
&lt;br /&gt;
== Source Code:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The difference is only this part in the Bascom source code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
'Here you need MAC address, the ip address you like to use, subnet mask, gateway and localport&lt;br /&gt;
 Config Tcpip = Noint , _&lt;br /&gt;
 Mac = 1.1.94.127.1.255 , _&lt;br /&gt;
 Ip = 192.168.2.254 , _&lt;br /&gt;
 Submask = 255.255.255.0 , _&lt;br /&gt;
 Gateway = 192.168.2.1 , _&lt;br /&gt;
 Localport = 1000 , _&lt;br /&gt;
 Tx = $55 , Rx = $55 , _&lt;br /&gt;
 Chip = W5100 , _&lt;br /&gt;
 Spi = 1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Complete Source code:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
' IP Address of Arduino = 192.168.2.254&lt;br /&gt;
' Port of Arduino = 1000&lt;br /&gt;
' We use UDP&lt;br /&gt;
'&lt;br /&gt;
&lt;br /&gt;
'Use Hardware:&lt;br /&gt;
' - Arduino UNO R3&lt;br /&gt;
' - Arduino Ethernet Shield with W5100 Wiznet Chip&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
' NTP Server IP address (here you can change the NTP server of your choice)&lt;br /&gt;
Const Ntp1 = 192 : Const Ntp2 = 53 : Const Ntp3 = 103 : Const Ntp4 = 108 ' Example = 192.53.103.108&lt;br /&gt;
&lt;br /&gt;
Const Use_ping = 1 'use PING NTP server for checking NTP server availability before move on&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$regfile = &amp;quot;m328pdef.dat&amp;quot;&lt;br /&gt;
$crystal = 16000000 '16MHz&lt;br /&gt;
$hwstack = 100&lt;br /&gt;
$swstack = 100&lt;br /&gt;
$framesize = 400&lt;br /&gt;
&lt;br /&gt;
Config Com1 = 57600 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Server Variables&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Ip_sntp_server As Long&lt;br /&gt;
'assign the IP number of a SNTP server&lt;br /&gt;
Ip_sntp_server = Maketcp(ntp1 , Ntp2 , Ntp3 , Ntp4) 'assign IP of NTP SERVER&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Wait 2&lt;br /&gt;
Print&lt;br /&gt;
Print &amp;quot;-----START Arduino UNO R3 + Ethernet Shield DEMO-----&amp;quot;&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Network Hardware&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = Low , Phase = 0 , Clockrate = 4 , Noss = 0&lt;br /&gt;
Spiinit&lt;br /&gt;
&lt;br /&gt;
Print&lt;br /&gt;
Enable Interrupts&lt;br /&gt;
&lt;br /&gt;
 'Here you need MAC address, the ip address you like to use, subnet mask, gateway and localport&lt;br /&gt;
 Config Tcpip = Noint , _&lt;br /&gt;
 Mac = 1.1.94.127.1.255 , _&lt;br /&gt;
 Ip = 192.168.2.254 , _&lt;br /&gt;
 Submask = 255.255.255.0 , _&lt;br /&gt;
 Gateway = 192.168.2.1 , _&lt;br /&gt;
 Localport = 1000 , _&lt;br /&gt;
 Tx = $55 , Rx = $55 , _&lt;br /&gt;
 Chip = W5100 , _&lt;br /&gt;
 Spi = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Config Clock&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Local_time As Long&lt;br /&gt;
Dim New_second As Bit&lt;br /&gt;
&lt;br /&gt;
Config Date = Dmy , Separator = .&lt;br /&gt;
Config Clock = User&lt;br /&gt;
&lt;br /&gt;
Config Timer1 = Timer , Prescale = 256&lt;br /&gt;
On Timer1 Timer_irq Saveall 'the SAVEALL option is NEEDED !&lt;br /&gt;
Const Timer_preload = 3036&lt;br /&gt;
Enable Timer1&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' UDP&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Idx As Byte ' socket number&lt;br /&gt;
Dim Result As Word ' result&lt;br /&gt;
Dim S(255) As Byte&lt;br /&gt;
Dim R(255) As Byte&lt;br /&gt;
Dim Sstr As String * 255&lt;br /&gt;
Dim Temp As Byte , Temp2 As Byte ' temp bytes&lt;br /&gt;
Dim Ip As Long&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' PING NTP SERVER to check if NTP server is available&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
#if Use_ping = 1&lt;br /&gt;
 Dim J As Byte , Res As Byte&lt;br /&gt;
 Dim Ii As Byte&lt;br /&gt;
 Dim Ping_check_ok As Bit&lt;br /&gt;
&lt;br /&gt;
 ' FILL PING ARRAY&lt;br /&gt;
 S(1) = 8 'type is echo&lt;br /&gt;
 S(2) = 0 'code&lt;br /&gt;
&lt;br /&gt;
 S(3) = 0 ' for checksum initialization&lt;br /&gt;
 S(4) = 0 ' checksum&lt;br /&gt;
 S(5) = 0 ' a signature can be any number&lt;br /&gt;
 S(6) = 1 ' signature&lt;br /&gt;
 S(7) = 0 ' sequence number - any number&lt;br /&gt;
 S(8) = 1&lt;br /&gt;
 S(9) = 65&lt;br /&gt;
&lt;br /&gt;
 Dim W As Word At S + 2 Overlay 'same as dta(3) and dta(4)&lt;br /&gt;
 Dim B As Byte&lt;br /&gt;
 W = Tcpchecksum(s(1) , 9) ' calculate checksum and store in dta(3) and dta(4)&lt;br /&gt;
&lt;br /&gt;
 'Ip = Maketcp(192.53.103.108) 'try to check this google server&lt;br /&gt;
 Print &amp;quot;PING NTP Server : &amp;quot; ; Ip2str(ip_sntp_server)&lt;br /&gt;
&lt;br /&gt;
 'Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
 Setipprotocol Idx , 1 'set protocol to 1&lt;br /&gt;
 'the protocol value must be set BEFORE the socket is openend&lt;br /&gt;
&lt;br /&gt;
 Idx = Getsocket(idx , Sock_ipl_raw , 5000 , 0) 'RAW Socket&lt;br /&gt;
&lt;br /&gt;
 ' We try the PING 3 times (but if we get an answer we exit the for loop)&lt;br /&gt;
 Do&lt;br /&gt;
 Incr Ii&lt;br /&gt;
&lt;br /&gt;
 Result = Udpwrite(ip_sntp_server , 7 , Idx , S(1) , 9) 'write ping data '&lt;br /&gt;
 Print &amp;quot;Ping Number : &amp;quot; ; ii&lt;br /&gt;
 Waitms 200 ' depending on the hops, speed, etc&lt;br /&gt;
 Result = Socketstat(idx , Sel_recv) 'check for data&lt;br /&gt;
 ' Print &amp;quot;REC:&amp;quot; ; Result&lt;br /&gt;
 If Result &amp;gt;= 11 Then&lt;br /&gt;
&lt;br /&gt;
 Res = Tcpread(idx , R(1) , Result) 'get data with TCPREAD !!!&lt;br /&gt;
&lt;br /&gt;
 ' Print &amp;quot;DATA RETURNED :&amp;quot; ; Res&lt;br /&gt;
 '( '&lt;br /&gt;
 For J = 1 To Result&lt;br /&gt;
 Print R(j) ; &amp;quot; &amp;quot; ;&lt;br /&gt;
 Next&lt;br /&gt;
 Print&lt;br /&gt;
 ')&lt;br /&gt;
 Print &amp;quot;PING OK --&amp;gt; Exit Do..Loop&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 Set Ping_check_ok&lt;br /&gt;
&lt;br /&gt;
 Exit Do ' If we can an answer from NTP Server exit do ... loop&lt;br /&gt;
&lt;br /&gt;
 Else&lt;br /&gt;
 Print &amp;quot;NTP Server not available&amp;quot;&lt;br /&gt;
 End If&lt;br /&gt;
 Waitms 100&lt;br /&gt;
&lt;br /&gt;
 Loop Until Ii = 3&lt;br /&gt;
&lt;br /&gt;
 Ii = 0&lt;br /&gt;
#else&lt;br /&gt;
 Dim Ping_check_ok As Bit&lt;br /&gt;
 Ping_check_ok = 1&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' SNTP&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
If Ping_check_ok = 1 Then 'When the NTP Serverer responded to PING&lt;br /&gt;
 'we need to get a socket first&lt;br /&gt;
 'note that for UDP we specify sock_dgram&lt;br /&gt;
 Idx = Getsocket(idx , Sock_dgram , 1000 , 0) ' get socket for UDP mode, specify port&lt;br /&gt;
 Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
&lt;br /&gt;
 Local_time = Sntp(idx , Ip_sntp_server) ' get time from SNTP server&lt;br /&gt;
 Print &amp;quot;Local_time = &amp;quot; ; Local_time&lt;br /&gt;
&lt;br /&gt;
 If Local_time &amp;lt; 100 Then 'try it again&lt;br /&gt;
 Wait 1&lt;br /&gt;
 Local_time = Sntp(idx , Ip_sntp_server) ' get time from SNTP server&lt;br /&gt;
 Print &amp;quot;Second try ; Local_time = &amp;quot; ; Local_time&lt;br /&gt;
 End If&lt;br /&gt;
&lt;br /&gt;
 Local_time = Local_time + 3600 ' (UTC/GMT) time + 3600&lt;br /&gt;
 Print Date(local_time) ; Spc(3) ; Time(local_time)&lt;br /&gt;
End If&lt;br /&gt;
&lt;br /&gt;
'get a socket first&lt;br /&gt;
'note that for UDP we specify sock_dgram&lt;br /&gt;
Idx = Getsocket(idx , Sock_dgram , 1000 , 0) ' get socket for UDP mode, specify port&lt;br /&gt;
'Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Do&lt;br /&gt;
 If New_second = 1 Then&lt;br /&gt;
 Reset New_second&lt;br /&gt;
 'Do something every second ......&lt;br /&gt;
 End If&lt;br /&gt;
&lt;br /&gt;
 'The UDP header give us info about Peersize, Peerport and peeraddress&lt;br /&gt;
 'which is the amount of data bytes received from peerport and peer ip address&lt;br /&gt;
 Udpreadheader Idx ' read the udp header (only the first 8 Bytes)&lt;br /&gt;
&lt;br /&gt;
 If Peersize &amp;gt; 0 Then ' the actual number of bytes (without header bytes)&lt;br /&gt;
 Print &amp;quot;Size= &amp;quot; ; Peersize ; &amp;quot; By&amp;quot; ; &amp;quot; Port= &amp;quot; ; Peerport ; &amp;quot; Sender IP= &amp;quot; ; Ip2str(peeraddress) ; &amp;quot; Timestamp : &amp;quot; ; Date$ ; &amp;quot; / &amp;quot; ; Time$&lt;br /&gt;
 Temp = Udpread(idx , S(1) , Peersize) ' read the number of Bytes into Array S&lt;br /&gt;
 Print &amp;quot;DATA = &amp;quot; ;&lt;br /&gt;
 For Temp = 1 To Peersize&lt;br /&gt;
 Print Chr(s(temp)) ; ' print what we have received over USART to debug interface&lt;br /&gt;
 Next&lt;br /&gt;
 Print&lt;br /&gt;
 'Send it back to sender IP, Sender Port&lt;br /&gt;
 Result = Udpwrite(peeraddress , Peerport , Idx , S(1) , Peersize) ' write the received data back&lt;br /&gt;
 End If&lt;br /&gt;
Loop&lt;br /&gt;
&lt;br /&gt;
End&lt;br /&gt;
&lt;br /&gt;
Timer_irq:&lt;br /&gt;
 Incr Local_time&lt;br /&gt;
 Time$ = Time(local_time)&lt;br /&gt;
 Date$ = Date(local_time)&lt;br /&gt;
 Set New_second&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Getdatetime:&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Settime:&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Setdate:&lt;br /&gt;
Return&lt;br /&gt;
&amp;lt;/source&amp;gt;See Getting started with Arduino and WIZ820io [http://wiki.mcselec.com/Getting_started_with_Arduino_and_WIZ820io http://wiki.mcselec.com/Getting_started_with_Arduino_and_WIZ820io]&lt;br /&gt;
&lt;br /&gt;
to know how to use this example code.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Terminal Output of example:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
-----START Arduino UNO R3 + Ethernet Shield DEMO-----&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;PING NTP Server : 192.53.103.108&amp;lt;br/&amp;gt;Ping Number : 1&amp;lt;br/&amp;gt;PING OK --&amp;gt; Exit Do..Loop&amp;lt;br/&amp;gt;Socket 0 0&amp;lt;br/&amp;gt;Local_time = 416063775&amp;lt;br/&amp;gt;08.03.13&amp;amp;nbsp;&amp;amp;nbsp; 14:16:15&amp;lt;br/&amp;gt;Size= 5 By&amp;amp;nbsp; Port= 50000 Sender IP= 192.168.2.100&amp;amp;nbsp; Timestamp : 08.03.13 / 14:16:45&amp;lt;br/&amp;gt;DATA = Hello&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Author&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
MAK3&lt;br /&gt;
&lt;br /&gt;
[[Category:Projects]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)</id>
		<title>Getting started with Arduino UNO R3 and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-08T13:35:23Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Please read first this Article:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Getting started with Arduino and WIZ820io [http://wiki.mcselec.com/Getting_started_with_Arduino_and_WIZ820io http://wiki.mcselec.com/Getting_started_with_Arduino_and_WIZ820io]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It uses the same source code exept we use here an Wiznet W5100 Chip intead of W5200 so only '''config TCPIP '''needs to be changed.&lt;br /&gt;
&lt;br /&gt;
The usage of Easy TCP/IP in combination with that example is also the same.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another difference is that in this example we do not use the Bascom-AVR bootloader. We use here the existing Arduino bootloader.&lt;br /&gt;
&lt;br /&gt;
To get started with this see here:&amp;amp;nbsp; [http://wiki.mcselec.com/Getting_started_with_Arduino_UNO http://wiki.mcselec.com/Getting_started_with_Arduino_UNO]&lt;br /&gt;
&lt;br /&gt;
== Source Code:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The difference is only this part in the Bascom source code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
'Here you need MAC address, the ip address you like to use, subnet mask, gateway and localport&lt;br /&gt;
 Config Tcpip = Noint , _&lt;br /&gt;
 Mac = 1.1.94.127.1.255 , _&lt;br /&gt;
 Ip = 192.168.2.254 , _&lt;br /&gt;
 Submask = 255.255.255.0 , _&lt;br /&gt;
 Gateway = 192.168.2.1 , _&lt;br /&gt;
 Localport = 1000 , _&lt;br /&gt;
 Tx = $55 , Rx = $55 , _&lt;br /&gt;
 Chip = W5100 , _&lt;br /&gt;
 Spi = 1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Complete Source code:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
' IP Address of Arduino = 192.168.2.254&lt;br /&gt;
' Port of Arduino = 1000&lt;br /&gt;
' We use UDP&lt;br /&gt;
'&lt;br /&gt;
&lt;br /&gt;
'Use Hardware:&lt;br /&gt;
' - Arduino UNO R3&lt;br /&gt;
' - Arduino Ethernet Shield with W5100 Wiznet Chip&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
' NTP Server IP address (here you can change the NTP server of your choice)&lt;br /&gt;
Const Ntp1 = 192 : Const Ntp2 = 53 : Const Ntp3 = 103 : Const Ntp4 = 108 ' Example = 192.53.103.108&lt;br /&gt;
&lt;br /&gt;
Const Use_ping = 1 'use PING NTP server for checking NTP server availability before move on&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$regfile = &amp;quot;m328pdef.dat&amp;quot;&lt;br /&gt;
$crystal = 16000000 '16MHz&lt;br /&gt;
$hwstack = 100&lt;br /&gt;
$swstack = 100&lt;br /&gt;
$framesize = 400&lt;br /&gt;
&lt;br /&gt;
Config Com1 = 57600 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Server Variables&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Ip_sntp_server As Long&lt;br /&gt;
'assign the IP number of a SNTP server&lt;br /&gt;
Ip_sntp_server = Maketcp(ntp1 , Ntp2 , Ntp3 , Ntp4) 'assign IP of NTP SERVER&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Wait 2&lt;br /&gt;
Print&lt;br /&gt;
Print &amp;quot;-----START Arduino UNO R3 + Ethernet Shield DEMO-----&amp;quot;&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Network Hardware&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = Low , Phase = 0 , Clockrate = 4 , Noss = 0&lt;br /&gt;
Spiinit&lt;br /&gt;
&lt;br /&gt;
Print&lt;br /&gt;
Enable Interrupts&lt;br /&gt;
&lt;br /&gt;
 'Here you need MAC address, the ip address you like to use, subnet mask, gateway and localport&lt;br /&gt;
 Config Tcpip = Noint , _&lt;br /&gt;
 Mac = 1.1.94.127.1.255 , _&lt;br /&gt;
 Ip = 192.168.2.254 , _&lt;br /&gt;
 Submask = 255.255.255.0 , _&lt;br /&gt;
 Gateway = 192.168.2.1 , _&lt;br /&gt;
 Localport = 1000 , _&lt;br /&gt;
 Tx = $55 , Rx = $55 , _&lt;br /&gt;
 Chip = W5100 , _&lt;br /&gt;
 Spi = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Config Clock&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Local_time As Long&lt;br /&gt;
Dim New_second As Bit&lt;br /&gt;
&lt;br /&gt;
Config Date = Dmy , Separator = .&lt;br /&gt;
Config Clock = User&lt;br /&gt;
&lt;br /&gt;
Config Timer1 = Timer , Prescale = 256&lt;br /&gt;
On Timer1 Timer_irq Saveall 'the SAVEALL option is NEEDED !&lt;br /&gt;
Const Timer_preload = 3036&lt;br /&gt;
Enable Timer1&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' UDP&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Idx As Byte ' socket number&lt;br /&gt;
Dim Result As Word ' result&lt;br /&gt;
Dim S(255) As Byte&lt;br /&gt;
Dim R(255) As Byte&lt;br /&gt;
Dim Sstr As String * 255&lt;br /&gt;
Dim Temp As Byte , Temp2 As Byte ' temp bytes&lt;br /&gt;
Dim Ip As Long&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' PING NTP SERVER to check if NTP server is available&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
#if Use_ping = 1&lt;br /&gt;
 Dim J As Byte , Res As Byte&lt;br /&gt;
 Dim Ii As Byte&lt;br /&gt;
 Dim Ping_check_ok As Bit&lt;br /&gt;
&lt;br /&gt;
 ' FILL PING ARRAY&lt;br /&gt;
 S(1) = 8 'type is echo&lt;br /&gt;
 S(2) = 0 'code&lt;br /&gt;
&lt;br /&gt;
 S(3) = 0 ' for checksum initialization&lt;br /&gt;
 S(4) = 0 ' checksum&lt;br /&gt;
 S(5) = 0 ' a signature can be any number&lt;br /&gt;
 S(6) = 1 ' signature&lt;br /&gt;
 S(7) = 0 ' sequence number - any number&lt;br /&gt;
 S(8) = 1&lt;br /&gt;
 S(9) = 65&lt;br /&gt;
&lt;br /&gt;
 Dim W As Word At S + 2 Overlay 'same as dta(3) and dta(4)&lt;br /&gt;
 Dim B As Byte&lt;br /&gt;
 W = Tcpchecksum(s(1) , 9) ' calculate checksum and store in dta(3) and dta(4)&lt;br /&gt;
&lt;br /&gt;
 'Ip = Maketcp(192.53.103.108) 'try to check this google server&lt;br /&gt;
 Print &amp;quot;PING NTP Server : &amp;quot; ; Ip2str(ip_sntp_server)&lt;br /&gt;
&lt;br /&gt;
 'Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
 Setipprotocol Idx , 1 'set protocol to 1&lt;br /&gt;
 'the protocol value must be set BEFORE the socket is openend&lt;br /&gt;
&lt;br /&gt;
 Idx = Getsocket(idx , Sock_ipl_raw , 5000 , 0) 'RAW Socket&lt;br /&gt;
&lt;br /&gt;
 ' We try the PING 3 times (but if we get an answer we exit the for loop)&lt;br /&gt;
 Do&lt;br /&gt;
 Incr Ii&lt;br /&gt;
&lt;br /&gt;
 Result = Udpwrite(ip_sntp_server , 7 , Idx , S(1) , 9) 'write ping data '&lt;br /&gt;
 Print &amp;quot;Ping Number : &amp;quot; ; ii&lt;br /&gt;
 Waitms 200 ' depending on the hops, speed, etc&lt;br /&gt;
 Result = Socketstat(idx , Sel_recv) 'check for data&lt;br /&gt;
 ' Print &amp;quot;REC:&amp;quot; ; Result&lt;br /&gt;
 If Result &amp;gt;= 11 Then&lt;br /&gt;
&lt;br /&gt;
 Res = Tcpread(idx , R(1) , Result) 'get data with TCPREAD !!!&lt;br /&gt;
&lt;br /&gt;
 ' Print &amp;quot;DATA RETURNED :&amp;quot; ; Res&lt;br /&gt;
 '( '&lt;br /&gt;
 For J = 1 To Result&lt;br /&gt;
 Print R(j) ; &amp;quot; &amp;quot; ;&lt;br /&gt;
 Next&lt;br /&gt;
 Print&lt;br /&gt;
 ')&lt;br /&gt;
 Print &amp;quot;PING OK --&amp;gt; Exit Do..Loop&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 Set Ping_check_ok&lt;br /&gt;
&lt;br /&gt;
 Exit Do ' If we can an answer from NTP Server exit do ... loop&lt;br /&gt;
&lt;br /&gt;
 Else&lt;br /&gt;
 Print &amp;quot;NTP Server not available&amp;quot;&lt;br /&gt;
 End If&lt;br /&gt;
 Waitms 100&lt;br /&gt;
&lt;br /&gt;
 Loop Until Ii = 3&lt;br /&gt;
&lt;br /&gt;
 Ii = 0&lt;br /&gt;
#else&lt;br /&gt;
 Dim Ping_check_ok As Bit&lt;br /&gt;
 Ping_check_ok = 1&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' SNTP&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
If Ping_check_ok = 1 Then 'When the NTP Serverer responded to PING&lt;br /&gt;
 'we need to get a socket first&lt;br /&gt;
 'note that for UDP we specify sock_dgram&lt;br /&gt;
 Idx = Getsocket(idx , Sock_dgram , 1000 , 0) ' get socket for UDP mode, specify port&lt;br /&gt;
 Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
&lt;br /&gt;
 Local_time = Sntp(idx , Ip_sntp_server) ' get time from SNTP server&lt;br /&gt;
 Print &amp;quot;Local_time = &amp;quot; ; Local_time&lt;br /&gt;
&lt;br /&gt;
 If Local_time &amp;lt; 100 Then 'try it again&lt;br /&gt;
 Wait 1&lt;br /&gt;
 Local_time = Sntp(idx , Ip_sntp_server) ' get time from SNTP server&lt;br /&gt;
 Print &amp;quot;Second try ; Local_time = &amp;quot; ; Local_time&lt;br /&gt;
 End If&lt;br /&gt;
&lt;br /&gt;
 Local_time = Local_time + 3600 ' (UTC/GMT) time + 3600&lt;br /&gt;
 Print Date(local_time) ; Spc(3) ; Time(local_time)&lt;br /&gt;
End If&lt;br /&gt;
&lt;br /&gt;
'get a socket first&lt;br /&gt;
'note that for UDP we specify sock_dgram&lt;br /&gt;
Idx = Getsocket(idx , Sock_dgram , 1000 , 0) ' get socket for UDP mode, specify port&lt;br /&gt;
'Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Do&lt;br /&gt;
 If New_second = 1 Then&lt;br /&gt;
 Reset New_second&lt;br /&gt;
 'Do something every second ......&lt;br /&gt;
 End If&lt;br /&gt;
&lt;br /&gt;
 'The UDP header give us info about Peersize, Peerport and peeraddress&lt;br /&gt;
 'which is the amount of data bytes received from peerport and peer ip address&lt;br /&gt;
 Udpreadheader Idx ' read the udp header (only the first 8 Bytes)&lt;br /&gt;
&lt;br /&gt;
 If Peersize &amp;gt; 0 Then ' the actual number of bytes (without header bytes)&lt;br /&gt;
 Print &amp;quot;Size= &amp;quot; ; Peersize ; &amp;quot; By&amp;quot; ; &amp;quot; Port= &amp;quot; ; Peerport ; &amp;quot; Sender IP= &amp;quot; ; Ip2str(peeraddress) ; &amp;quot; Timestamp : &amp;quot; ; Date$ ; &amp;quot; / &amp;quot; ; Time$&lt;br /&gt;
 Temp = Udpread(idx , S(1) , Peersize) ' read the number of Bytes into Array S&lt;br /&gt;
 Print &amp;quot;DATA = &amp;quot; ;&lt;br /&gt;
 For Temp = 1 To Peersize&lt;br /&gt;
 Print Chr(s(temp)) ; ' print what we have received over USART to debug interface&lt;br /&gt;
 Next&lt;br /&gt;
 Print&lt;br /&gt;
 'Send it back to sender IP, Sender Port&lt;br /&gt;
 Result = Udpwrite(peeraddress , Peerport , Idx , S(1) , Peersize) ' write the received data back&lt;br /&gt;
 End If&lt;br /&gt;
Loop&lt;br /&gt;
&lt;br /&gt;
End&lt;br /&gt;
&lt;br /&gt;
Timer_irq:&lt;br /&gt;
 Incr Local_time&lt;br /&gt;
 Time$ = Time(local_time)&lt;br /&gt;
 Date$ = Date(local_time)&lt;br /&gt;
 Set New_second&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Getdatetime:&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Settime:&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Setdate:&lt;br /&gt;
Return&lt;br /&gt;
&amp;lt;/source&amp;gt;See Getting started with Arduino and WIZ820io [http://wiki.mcselec.com/Getting_started_with_Arduino_and_WIZ820io http://wiki.mcselec.com/Getting_started_with_Arduino_and_WIZ820io]&lt;br /&gt;
&lt;br /&gt;
to know how to use this example code.&lt;br /&gt;
&lt;br /&gt;
== Author&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
MAK3&lt;br /&gt;
&lt;br /&gt;
[[Category:Projects]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)</id>
		<title>Getting started with Arduino UNO R3 and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-08T13:34:27Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Please read first this Article:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Getting started with Arduino and WIZ820io [http://wiki.mcselec.com/Getting_started_with_Arduino_and_WIZ820io http://wiki.mcselec.com/Getting_started_with_Arduino_and_WIZ820io]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It uses the same source code exept we use here an Wiznet W5100 Chip intead of W5200 so only '''config TCPIP '''needs to be changed.&lt;br /&gt;
&lt;br /&gt;
The usage of Easy TCP/IP in combination with that example is also the same.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another difference is that in this example we do not use the Bascom-AVR bootloader. We use here the existing Arduino bootloader.&lt;br /&gt;
&lt;br /&gt;
To get started with this see here:&amp;amp;nbsp; [http://wiki.mcselec.com/Getting_started_with_Arduino_UNO http://wiki.mcselec.com/Getting_started_with_Arduino_UNO]&lt;br /&gt;
&lt;br /&gt;
== Source Code:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The difference is only this part in the Bascom source code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
'Here you need MAC address, the ip address you like to use, subnet mask, gateway and localport&lt;br /&gt;
 Config Tcpip = Noint , _&lt;br /&gt;
 Mac = 1.1.94.127.1.255 , _&lt;br /&gt;
 Ip = 192.168.2.254 , _&lt;br /&gt;
 Submask = 255.255.255.0 , _&lt;br /&gt;
 Gateway = 192.168.2.1 , _&lt;br /&gt;
 Localport = 1000 , _&lt;br /&gt;
 Tx = $55 , Rx = $55 , _&lt;br /&gt;
 Chip = W5100 , _&lt;br /&gt;
 Spi = 1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Complete Source code:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
' IP Address of Arduino = 192.168.2.254&lt;br /&gt;
' Port of Arduino = 1000&lt;br /&gt;
' We use UDP&lt;br /&gt;
'&lt;br /&gt;
&lt;br /&gt;
'Use Hardware:&lt;br /&gt;
' - Arduino UNO R3&lt;br /&gt;
' - Arduino Ethernet Shield with W5100 Wiznet Chip&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
' NTP Server IP address (here you can change the NTP server of your choice)&lt;br /&gt;
Const Ntp1 = 192 : Const Ntp2 = 53 : Const Ntp3 = 103 : Const Ntp4 = 108 ' Example = 192.53.103.108&lt;br /&gt;
&lt;br /&gt;
Const Use_ping = 1 'use PING NTP server for checking NTP server availability before move on&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$regfile = &amp;quot;m328pdef.dat&amp;quot;&lt;br /&gt;
$crystal = 16000000 '16MHz&lt;br /&gt;
$hwstack = 100&lt;br /&gt;
$swstack = 100&lt;br /&gt;
$framesize = 400&lt;br /&gt;
&lt;br /&gt;
Config Com1 = 57600 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Server Variables&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Ip_sntp_server As Long&lt;br /&gt;
'assign the IP number of a SNTP server&lt;br /&gt;
Ip_sntp_server = Maketcp(ntp1 , Ntp2 , Ntp3 , Ntp4) 'assign IP of NTP SERVER&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Wait 2&lt;br /&gt;
Print&lt;br /&gt;
Print &amp;quot;-----START Arduino UNO R3 + Ethernet Shield DEMO-----&amp;quot;&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Network Hardware&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = Low , Phase = 0 , Clockrate = 4 , Noss = 0&lt;br /&gt;
Spiinit&lt;br /&gt;
&lt;br /&gt;
Print&lt;br /&gt;
Enable Interrupts&lt;br /&gt;
&lt;br /&gt;
 'Here you need MAC address, the ip address you like to use, subnet mask, gateway and localport&lt;br /&gt;
 Config Tcpip = Noint , _&lt;br /&gt;
 Mac = 1.1.94.127.1.255 , _&lt;br /&gt;
 Ip = 192.168.2.254 , _&lt;br /&gt;
 Submask = 255.255.255.0 , _&lt;br /&gt;
 Gateway = 192.168.2.1 , _&lt;br /&gt;
 Localport = 1000 , _&lt;br /&gt;
 Tx = $55 , Rx = $55 , _&lt;br /&gt;
 Chip = W5100 , _&lt;br /&gt;
 Spi = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Config Clock&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Local_time As Long&lt;br /&gt;
Dim New_second As Bit&lt;br /&gt;
&lt;br /&gt;
Config Date = Dmy , Separator = .&lt;br /&gt;
Config Clock = User&lt;br /&gt;
&lt;br /&gt;
Config Timer1 = Timer , Prescale = 256&lt;br /&gt;
On Timer1 Timer_irq Saveall 'the SAVEALL option is NEEDED !&lt;br /&gt;
Const Timer_preload = 3036&lt;br /&gt;
Enable Timer1&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' UDP&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Idx As Byte ' socket number&lt;br /&gt;
Dim Result As Word ' result&lt;br /&gt;
Dim S(255) As Byte&lt;br /&gt;
Dim R(255) As Byte&lt;br /&gt;
Dim Sstr As String * 255&lt;br /&gt;
Dim Temp As Byte , Temp2 As Byte ' temp bytes&lt;br /&gt;
Dim Ip As Long&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' PING NTP SERVER to check if NTP server is available&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
#if Use_ping = 1&lt;br /&gt;
 Dim J As Byte , Res As Byte&lt;br /&gt;
 Dim Ii As Byte&lt;br /&gt;
 Dim Ping_check_ok As Bit&lt;br /&gt;
&lt;br /&gt;
 ' FILL PING ARRAY&lt;br /&gt;
 S(1) = 8 'type is echo&lt;br /&gt;
 S(2) = 0 'code&lt;br /&gt;
&lt;br /&gt;
 S(3) = 0 ' for checksum initialization&lt;br /&gt;
 S(4) = 0 ' checksum&lt;br /&gt;
 S(5) = 0 ' a signature can be any number&lt;br /&gt;
 S(6) = 1 ' signature&lt;br /&gt;
 S(7) = 0 ' sequence number - any number&lt;br /&gt;
 S(8) = 1&lt;br /&gt;
 S(9) = 65&lt;br /&gt;
&lt;br /&gt;
 Dim W As Word At S + 2 Overlay 'same as dta(3) and dta(4)&lt;br /&gt;
 Dim B As Byte&lt;br /&gt;
 W = Tcpchecksum(s(1) , 9) ' calculate checksum and store in dta(3) and dta(4)&lt;br /&gt;
&lt;br /&gt;
 'Ip = Maketcp(192.53.103.108) 'try to check this google server&lt;br /&gt;
 Print &amp;quot;PING NTP Server : &amp;quot; ; Ip2str(ip_sntp_server)&lt;br /&gt;
&lt;br /&gt;
 'Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
 Setipprotocol Idx , 1 'set protocol to 1&lt;br /&gt;
 'the protocol value must be set BEFORE the socket is openend&lt;br /&gt;
&lt;br /&gt;
 Idx = Getsocket(idx , Sock_ipl_raw , 5000 , 0) 'RAW Socket&lt;br /&gt;
&lt;br /&gt;
 ' We try the PING 3 times (but if we get an answer we exit the for loop)&lt;br /&gt;
 Do&lt;br /&gt;
 Incr Ii&lt;br /&gt;
&lt;br /&gt;
 Result = Udpwrite(ip_sntp_server , 7 , Idx , S(1) , 9) 'write ping data '&lt;br /&gt;
 Print &amp;quot;Ping Number : &amp;quot; ; ii&lt;br /&gt;
 Waitms 200 ' depending on the hops, speed, etc&lt;br /&gt;
 Result = Socketstat(idx , Sel_recv) 'check for data&lt;br /&gt;
 ' Print &amp;quot;REC:&amp;quot; ; Result&lt;br /&gt;
 If Result &amp;gt;= 11 Then&lt;br /&gt;
&lt;br /&gt;
 Res = Tcpread(idx , R(1) , Result) 'get data with TCPREAD !!!&lt;br /&gt;
&lt;br /&gt;
 ' Print &amp;quot;DATA RETURNED :&amp;quot; ; Res&lt;br /&gt;
 '( '&lt;br /&gt;
 For J = 1 To Result&lt;br /&gt;
 Print R(j) ; &amp;quot; &amp;quot; ;&lt;br /&gt;
 Next&lt;br /&gt;
 Print&lt;br /&gt;
 ')&lt;br /&gt;
 Print &amp;quot;PING OK --&amp;gt; Exit Do..Loop&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 Set Ping_check_ok&lt;br /&gt;
&lt;br /&gt;
 Exit Do ' If we can an answer from NTP Server exit do ... loop&lt;br /&gt;
&lt;br /&gt;
 Else&lt;br /&gt;
 Print &amp;quot;NTP Server not available&amp;quot;&lt;br /&gt;
 End If&lt;br /&gt;
 Waitms 100&lt;br /&gt;
&lt;br /&gt;
 Loop Until Ii = 3&lt;br /&gt;
&lt;br /&gt;
 Ii = 0&lt;br /&gt;
#else&lt;br /&gt;
 Dim Ping_check_ok As Bit&lt;br /&gt;
 Ping_check_ok = 1&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' SNTP&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
If Ping_check_ok = 1 Then 'When the NTP Serverer responded to PING&lt;br /&gt;
 'we need to get a socket first&lt;br /&gt;
 'note that for UDP we specify sock_dgram&lt;br /&gt;
 Idx = Getsocket(idx , Sock_dgram , 1000 , 0) ' get socket for UDP mode, specify port&lt;br /&gt;
 Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
&lt;br /&gt;
 Local_time = Sntp(idx , Ip_sntp_server) ' get time from SNTP server&lt;br /&gt;
 Print &amp;quot;Local_time = &amp;quot; ; Local_time&lt;br /&gt;
&lt;br /&gt;
 If Local_time &amp;lt; 100 Then 'try it again&lt;br /&gt;
 Wait 1&lt;br /&gt;
 Local_time = Sntp(idx , Ip_sntp_server) ' get time from SNTP server&lt;br /&gt;
 Print &amp;quot;Second try ; Local_time = &amp;quot; ; Local_time&lt;br /&gt;
 End If&lt;br /&gt;
&lt;br /&gt;
 Local_time = Local_time + 3600 ' (UTC/GMT) time + 3600&lt;br /&gt;
 Print Date(local_time) ; Spc(3) ; Time(local_time)&lt;br /&gt;
End If&lt;br /&gt;
&lt;br /&gt;
'get a socket first&lt;br /&gt;
'note that for UDP we specify sock_dgram&lt;br /&gt;
Idx = Getsocket(idx , Sock_dgram , 1000 , 0) ' get socket for UDP mode, specify port&lt;br /&gt;
'Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Do&lt;br /&gt;
 If New_second = 1 Then&lt;br /&gt;
 Reset New_second&lt;br /&gt;
 'Do something every second ......&lt;br /&gt;
 End If&lt;br /&gt;
&lt;br /&gt;
 'The UDP header give us info about Peersize, Peerport and peeraddress&lt;br /&gt;
 'which is the amount of data bytes received from peerport and peer ip address&lt;br /&gt;
 Udpreadheader Idx ' read the udp header (only the first 8 Bytes)&lt;br /&gt;
&lt;br /&gt;
 If Peersize &amp;gt; 0 Then ' the actual number of bytes (without header bytes)&lt;br /&gt;
 Print &amp;quot;Size= &amp;quot; ; Peersize ; &amp;quot; By&amp;quot; ; &amp;quot; Port= &amp;quot; ; Peerport ; &amp;quot; Sender IP= &amp;quot; ; Ip2str(peeraddress) ; &amp;quot; Timestamp : &amp;quot; ; Date$ ; &amp;quot; / &amp;quot; ; Time$&lt;br /&gt;
 Temp = Udpread(idx , S(1) , Peersize) ' read the number of Bytes into Array S&lt;br /&gt;
 Print &amp;quot;DATA = &amp;quot; ;&lt;br /&gt;
 For Temp = 1 To Peersize&lt;br /&gt;
 Print Chr(s(temp)) ; ' print what we have received over USART to debug interface&lt;br /&gt;
 Next&lt;br /&gt;
 Print&lt;br /&gt;
 'Send it back to sender IP, Sender Port&lt;br /&gt;
 Result = Udpwrite(peeraddress , Peerport , Idx , S(1) , Peersize) ' write the received data back&lt;br /&gt;
 End If&lt;br /&gt;
Loop&lt;br /&gt;
&lt;br /&gt;
End&lt;br /&gt;
&lt;br /&gt;
Timer_irq:&lt;br /&gt;
 Incr Local_time&lt;br /&gt;
 Time$ = Time(local_time)&lt;br /&gt;
 Date$ = Date(local_time)&lt;br /&gt;
 Set New_second&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Getdatetime:&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Settime:&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Setdate:&lt;br /&gt;
Return&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Author&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
MAK3&lt;br /&gt;
&lt;br /&gt;
[[Category:Projects]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)</id>
		<title>Getting started with Arduino UNO R3 and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-08T13:33:44Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Please read first this Article:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Getting started with Arduino and WIZ820io --&amp;gt; [http://wiki.mcselec.com/Getting_started_with_Arduino_and_WIZ820io [1]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It uses the same source code exept we use here an Wiznet W5100 Chip intead of W5200 so only '''config TCPIP '''needs to be changed.&lt;br /&gt;
&lt;br /&gt;
The usage of Easy TCP/IP in combination with that example is also the same.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Another difference is that in this example we do not use the Bascom-AVR bootloader. We use here the existing Arduino bootloader.&lt;br /&gt;
&lt;br /&gt;
To get started with this see here:&amp;amp;nbsp; [http://wiki.mcselec.com/Getting_started_with_Arduino_UNO http://wiki.mcselec.com/Getting_started_with_Arduino_UNO]&lt;br /&gt;
&lt;br /&gt;
== Source Code:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The difference is only this part in the Bascom source code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
'Here you need MAC address, the ip address you like to use, subnet mask, gateway and localport&lt;br /&gt;
 Config Tcpip = Noint , _&lt;br /&gt;
 Mac = 1.1.94.127.1.255 , _&lt;br /&gt;
 Ip = 192.168.2.254 , _&lt;br /&gt;
 Submask = 255.255.255.0 , _&lt;br /&gt;
 Gateway = 192.168.2.1 , _&lt;br /&gt;
 Localport = 1000 , _&lt;br /&gt;
 Tx = $55 , Rx = $55 , _&lt;br /&gt;
 Chip = W5100 , _&lt;br /&gt;
 Spi = 1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Complete Source code:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
' IP Address of Arduino = 192.168.2.254&lt;br /&gt;
' Port of Arduino = 1000&lt;br /&gt;
' We use UDP&lt;br /&gt;
'&lt;br /&gt;
&lt;br /&gt;
'Use Hardware:&lt;br /&gt;
' - Arduino UNO R3&lt;br /&gt;
' - Arduino Ethernet Shield with W5100 Wiznet Chip&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
' NTP Server IP address (here you can change the NTP server of your choice)&lt;br /&gt;
Const Ntp1 = 192 : Const Ntp2 = 53 : Const Ntp3 = 103 : Const Ntp4 = 108 ' Example = 192.53.103.108&lt;br /&gt;
&lt;br /&gt;
Const Use_ping = 1 'use PING NTP server for checking NTP server availability before move on&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$regfile = &amp;quot;m328pdef.dat&amp;quot;&lt;br /&gt;
$crystal = 16000000 '16MHz&lt;br /&gt;
$hwstack = 100&lt;br /&gt;
$swstack = 100&lt;br /&gt;
$framesize = 400&lt;br /&gt;
&lt;br /&gt;
Config Com1 = 57600 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Server Variables&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Ip_sntp_server As Long&lt;br /&gt;
'assign the IP number of a SNTP server&lt;br /&gt;
Ip_sntp_server = Maketcp(ntp1 , Ntp2 , Ntp3 , Ntp4) 'assign IP of NTP SERVER&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Wait 2&lt;br /&gt;
Print&lt;br /&gt;
Print &amp;quot;-----START Arduino UNO R3 + Ethernet Shield DEMO-----&amp;quot;&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Network Hardware&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = Low , Phase = 0 , Clockrate = 4 , Noss = 0&lt;br /&gt;
Spiinit&lt;br /&gt;
&lt;br /&gt;
Print&lt;br /&gt;
Enable Interrupts&lt;br /&gt;
&lt;br /&gt;
 'Here you need MAC address, the ip address you like to use, subnet mask, gateway and localport&lt;br /&gt;
 Config Tcpip = Noint , _&lt;br /&gt;
 Mac = 1.1.94.127.1.255 , _&lt;br /&gt;
 Ip = 192.168.2.254 , _&lt;br /&gt;
 Submask = 255.255.255.0 , _&lt;br /&gt;
 Gateway = 192.168.2.1 , _&lt;br /&gt;
 Localport = 1000 , _&lt;br /&gt;
 Tx = $55 , Rx = $55 , _&lt;br /&gt;
 Chip = W5100 , _&lt;br /&gt;
 Spi = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Config Clock&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Local_time As Long&lt;br /&gt;
Dim New_second As Bit&lt;br /&gt;
&lt;br /&gt;
Config Date = Dmy , Separator = .&lt;br /&gt;
Config Clock = User&lt;br /&gt;
&lt;br /&gt;
Config Timer1 = Timer , Prescale = 256&lt;br /&gt;
On Timer1 Timer_irq Saveall 'the SAVEALL option is NEEDED !&lt;br /&gt;
Const Timer_preload = 3036&lt;br /&gt;
Enable Timer1&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' UDP&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Idx As Byte ' socket number&lt;br /&gt;
Dim Result As Word ' result&lt;br /&gt;
Dim S(255) As Byte&lt;br /&gt;
Dim R(255) As Byte&lt;br /&gt;
Dim Sstr As String * 255&lt;br /&gt;
Dim Temp As Byte , Temp2 As Byte ' temp bytes&lt;br /&gt;
Dim Ip As Long&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' PING NTP SERVER to check if NTP server is available&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
#if Use_ping = 1&lt;br /&gt;
 Dim J As Byte , Res As Byte&lt;br /&gt;
 Dim Ii As Byte&lt;br /&gt;
 Dim Ping_check_ok As Bit&lt;br /&gt;
&lt;br /&gt;
 ' FILL PING ARRAY&lt;br /&gt;
 S(1) = 8 'type is echo&lt;br /&gt;
 S(2) = 0 'code&lt;br /&gt;
&lt;br /&gt;
 S(3) = 0 ' for checksum initialization&lt;br /&gt;
 S(4) = 0 ' checksum&lt;br /&gt;
 S(5) = 0 ' a signature can be any number&lt;br /&gt;
 S(6) = 1 ' signature&lt;br /&gt;
 S(7) = 0 ' sequence number - any number&lt;br /&gt;
 S(8) = 1&lt;br /&gt;
 S(9) = 65&lt;br /&gt;
&lt;br /&gt;
 Dim W As Word At S + 2 Overlay 'same as dta(3) and dta(4)&lt;br /&gt;
 Dim B As Byte&lt;br /&gt;
 W = Tcpchecksum(s(1) , 9) ' calculate checksum and store in dta(3) and dta(4)&lt;br /&gt;
&lt;br /&gt;
 'Ip = Maketcp(192.53.103.108) 'try to check this google server&lt;br /&gt;
 Print &amp;quot;PING NTP Server : &amp;quot; ; Ip2str(ip_sntp_server)&lt;br /&gt;
&lt;br /&gt;
 'Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
 Setipprotocol Idx , 1 'set protocol to 1&lt;br /&gt;
 'the protocol value must be set BEFORE the socket is openend&lt;br /&gt;
&lt;br /&gt;
 Idx = Getsocket(idx , Sock_ipl_raw , 5000 , 0) 'RAW Socket&lt;br /&gt;
&lt;br /&gt;
 ' We try the PING 3 times (but if we get an answer we exit the for loop)&lt;br /&gt;
 Do&lt;br /&gt;
 Incr Ii&lt;br /&gt;
&lt;br /&gt;
 Result = Udpwrite(ip_sntp_server , 7 , Idx , S(1) , 9) 'write ping data '&lt;br /&gt;
 Print &amp;quot;Ping Number : &amp;quot; ; ii&lt;br /&gt;
 Waitms 200 ' depending on the hops, speed, etc&lt;br /&gt;
 Result = Socketstat(idx , Sel_recv) 'check for data&lt;br /&gt;
 ' Print &amp;quot;REC:&amp;quot; ; Result&lt;br /&gt;
 If Result &amp;gt;= 11 Then&lt;br /&gt;
&lt;br /&gt;
 Res = Tcpread(idx , R(1) , Result) 'get data with TCPREAD !!!&lt;br /&gt;
&lt;br /&gt;
 ' Print &amp;quot;DATA RETURNED :&amp;quot; ; Res&lt;br /&gt;
 '( '&lt;br /&gt;
 For J = 1 To Result&lt;br /&gt;
 Print R(j) ; &amp;quot; &amp;quot; ;&lt;br /&gt;
 Next&lt;br /&gt;
 Print&lt;br /&gt;
 ')&lt;br /&gt;
 Print &amp;quot;PING OK --&amp;gt; Exit Do..Loop&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 Set Ping_check_ok&lt;br /&gt;
&lt;br /&gt;
 Exit Do ' If we can an answer from NTP Server exit do ... loop&lt;br /&gt;
&lt;br /&gt;
 Else&lt;br /&gt;
 Print &amp;quot;NTP Server not available&amp;quot;&lt;br /&gt;
 End If&lt;br /&gt;
 Waitms 100&lt;br /&gt;
&lt;br /&gt;
 Loop Until Ii = 3&lt;br /&gt;
&lt;br /&gt;
 Ii = 0&lt;br /&gt;
#else&lt;br /&gt;
 Dim Ping_check_ok As Bit&lt;br /&gt;
 Ping_check_ok = 1&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' SNTP&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
If Ping_check_ok = 1 Then 'When the NTP Serverer responded to PING&lt;br /&gt;
 'we need to get a socket first&lt;br /&gt;
 'note that for UDP we specify sock_dgram&lt;br /&gt;
 Idx = Getsocket(idx , Sock_dgram , 1000 , 0) ' get socket for UDP mode, specify port&lt;br /&gt;
 Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
&lt;br /&gt;
 Local_time = Sntp(idx , Ip_sntp_server) ' get time from SNTP server&lt;br /&gt;
 Print &amp;quot;Local_time = &amp;quot; ; Local_time&lt;br /&gt;
&lt;br /&gt;
 If Local_time &amp;lt; 100 Then 'try it again&lt;br /&gt;
 Wait 1&lt;br /&gt;
 Local_time = Sntp(idx , Ip_sntp_server) ' get time from SNTP server&lt;br /&gt;
 Print &amp;quot;Second try ; Local_time = &amp;quot; ; Local_time&lt;br /&gt;
 End If&lt;br /&gt;
&lt;br /&gt;
 Local_time = Local_time + 3600 ' (UTC/GMT) time + 3600&lt;br /&gt;
 Print Date(local_time) ; Spc(3) ; Time(local_time)&lt;br /&gt;
End If&lt;br /&gt;
&lt;br /&gt;
'get a socket first&lt;br /&gt;
'note that for UDP we specify sock_dgram&lt;br /&gt;
Idx = Getsocket(idx , Sock_dgram , 1000 , 0) ' get socket for UDP mode, specify port&lt;br /&gt;
'Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Do&lt;br /&gt;
 If New_second = 1 Then&lt;br /&gt;
 Reset New_second&lt;br /&gt;
 'Do something every second ......&lt;br /&gt;
 End If&lt;br /&gt;
&lt;br /&gt;
 'The UDP header give us info about Peersize, Peerport and peeraddress&lt;br /&gt;
 'which is the amount of data bytes received from peerport and peer ip address&lt;br /&gt;
 Udpreadheader Idx ' read the udp header (only the first 8 Bytes)&lt;br /&gt;
&lt;br /&gt;
 If Peersize &amp;gt; 0 Then ' the actual number of bytes (without header bytes)&lt;br /&gt;
 Print &amp;quot;Size= &amp;quot; ; Peersize ; &amp;quot; By&amp;quot; ; &amp;quot; Port= &amp;quot; ; Peerport ; &amp;quot; Sender IP= &amp;quot; ; Ip2str(peeraddress) ; &amp;quot; Timestamp : &amp;quot; ; Date$ ; &amp;quot; / &amp;quot; ; Time$&lt;br /&gt;
 Temp = Udpread(idx , S(1) , Peersize) ' read the number of Bytes into Array S&lt;br /&gt;
 Print &amp;quot;DATA = &amp;quot; ;&lt;br /&gt;
 For Temp = 1 To Peersize&lt;br /&gt;
 Print Chr(s(temp)) ; ' print what we have received over USART to debug interface&lt;br /&gt;
 Next&lt;br /&gt;
 Print&lt;br /&gt;
 'Send it back to sender IP, Sender Port&lt;br /&gt;
 Result = Udpwrite(peeraddress , Peerport , Idx , S(1) , Peersize) ' write the received data back&lt;br /&gt;
 End If&lt;br /&gt;
Loop&lt;br /&gt;
&lt;br /&gt;
End&lt;br /&gt;
&lt;br /&gt;
Timer_irq:&lt;br /&gt;
 Incr Local_time&lt;br /&gt;
 Time$ = Time(local_time)&lt;br /&gt;
 Date$ = Date(local_time)&lt;br /&gt;
 Set New_second&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Getdatetime:&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Settime:&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Setdate:&lt;br /&gt;
Return&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Author&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
MAK3&lt;br /&gt;
&lt;br /&gt;
[[Category:Projects]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)</id>
		<title>Getting started with Arduino UNO R3 and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-08T13:30:33Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Please read first this Article:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Getting started with Arduino and WIZ820io --&amp;gt; [http://wiki.mcselec.com/Getting_started_with_Arduino_and_WIZ820io [1]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It uses the same source code exept we use here an Wiznet W5100 Chip intead of W5200 so only '''config TCPIP '''needs to be changed.&lt;br /&gt;
&lt;br /&gt;
The usage of Easy TCP/IP in combination with that example is also the same.&lt;br /&gt;
&lt;br /&gt;
== Source Code:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The difference is only this part in the Bascom source code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
'Here you need MAC address, the ip address you like to use, subnet mask, gateway and localport&lt;br /&gt;
 Config Tcpip = Noint , _&lt;br /&gt;
 Mac = 1.1.94.127.1.255 , _&lt;br /&gt;
 Ip = 192.168.2.254 , _&lt;br /&gt;
 Submask = 255.255.255.0 , _&lt;br /&gt;
 Gateway = 192.168.2.1 , _&lt;br /&gt;
 Localport = 1000 , _&lt;br /&gt;
 Tx = $55 , Rx = $55 , _&lt;br /&gt;
 Chip = W5100 , _&lt;br /&gt;
 Spi = 1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Complete Source code:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
' IP Address of Arduino = 192.168.2.254&lt;br /&gt;
' Port of Arduino = 1000&lt;br /&gt;
' We use UDP&lt;br /&gt;
'&lt;br /&gt;
&lt;br /&gt;
'Use Hardware:&lt;br /&gt;
' - Arduino UNO R3&lt;br /&gt;
' - Arduino Ethernet Shield with W5100 Wiznet Chip&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
' NTP Server IP address (here you can change the NTP server of your choice)&lt;br /&gt;
Const Ntp1 = 192 : Const Ntp2 = 53 : Const Ntp3 = 103 : Const Ntp4 = 108       ' Example =  192.53.103.108&lt;br /&gt;
&lt;br /&gt;
Const Use_ping = 1                                         'use PING NTP server for checking NTP server availability before move on&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$regfile = &amp;quot;m328pdef.dat&amp;quot;&lt;br /&gt;
$crystal = 16000000                                         '16MHz&lt;br /&gt;
$hwstack = 100&lt;br /&gt;
$swstack = 100&lt;br /&gt;
$framesize = 400&lt;br /&gt;
&lt;br /&gt;
Config Com1 = 57600 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Server Variables&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Ip_sntp_server As Long&lt;br /&gt;
'assign the IP number of a SNTP server&lt;br /&gt;
Ip_sntp_server = Maketcp(ntp1 , Ntp2 , Ntp3 , Ntp4)         'assign IP of NTP SERVER&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Wait 2&lt;br /&gt;
Print&lt;br /&gt;
Print &amp;quot;-----START Arduino UNO R3 + Ethernet Shield DEMO-----&amp;quot;&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Network Hardware&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = Low , Phase = 0 , Clockrate = 4 , Noss = 0&lt;br /&gt;
Spiinit&lt;br /&gt;
&lt;br /&gt;
Print&lt;br /&gt;
Enable Interrupts&lt;br /&gt;
&lt;br /&gt;
  'Here you need MAC address, the ip address you like to use, subnet mask, gateway and localport&lt;br /&gt;
  Config Tcpip = Noint , _&lt;br /&gt;
            Mac = 1.1.94.127.1.255 , _&lt;br /&gt;
            Ip = 192.168.2.254 , _&lt;br /&gt;
            Submask = 255.255.255.0 , _&lt;br /&gt;
            Gateway = 192.168.2.1 , _&lt;br /&gt;
            Localport = 1000 , _&lt;br /&gt;
            Tx = $55 , Rx = $55 , _&lt;br /&gt;
            Chip = W5100 , _&lt;br /&gt;
            Spi = 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
'  Config Clock&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Local_time As Long&lt;br /&gt;
Dim New_second As Bit&lt;br /&gt;
&lt;br /&gt;
Config Date = Dmy , Separator = .&lt;br /&gt;
Config Clock = User&lt;br /&gt;
&lt;br /&gt;
Config Timer1 = Timer , Prescale = 256&lt;br /&gt;
On Timer1 Timer_irq Saveall                                 'the SAVEALL option is NEEDED !&lt;br /&gt;
Const Timer_preload = 3036&lt;br /&gt;
Enable Timer1&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
'  UDP&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Idx As Byte                                             ' socket number&lt;br /&gt;
Dim Result As Word                                          ' result&lt;br /&gt;
Dim S(255) As Byte&lt;br /&gt;
Dim R(255) As Byte&lt;br /&gt;
Dim Sstr As String * 255&lt;br /&gt;
Dim Temp As Byte , Temp2 As Byte                            ' temp bytes&lt;br /&gt;
Dim Ip As Long&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
'  PING NTP SERVER to check if NTP server is available&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
#if Use_ping = 1&lt;br /&gt;
   Dim J As Byte , Res As Byte&lt;br /&gt;
   Dim Ii As Byte&lt;br /&gt;
   Dim Ping_check_ok As Bit&lt;br /&gt;
&lt;br /&gt;
   ' FILL PING ARRAY&lt;br /&gt;
   S(1) = 8                                                    'type is echo&lt;br /&gt;
   S(2) = 0                                                    'code&lt;br /&gt;
&lt;br /&gt;
   S(3) = 0                                                    ' for checksum initialization&lt;br /&gt;
   S(4) = 0                                                    ' checksum&lt;br /&gt;
   S(5) = 0                                                    ' a signature can be any number&lt;br /&gt;
   S(6) = 1                                                    '   signature&lt;br /&gt;
   S(7) = 0                                                    ' sequence number - any number&lt;br /&gt;
   S(8) = 1&lt;br /&gt;
   S(9) = 65&lt;br /&gt;
&lt;br /&gt;
   Dim W As Word At S + 2 Overlay                              'same as dta(3) and dta(4)&lt;br /&gt;
   Dim B As Byte&lt;br /&gt;
   W = Tcpchecksum(s(1) , 9)                                   ' calculate checksum and store in dta(3) and dta(4)&lt;br /&gt;
&lt;br /&gt;
   'Ip = Maketcp(192.53.103.108)                                'try to check this google server&lt;br /&gt;
   Print &amp;quot;PING NTP Server : &amp;quot; ; Ip2str(ip_sntp_server)&lt;br /&gt;
&lt;br /&gt;
   'Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
   Setipprotocol Idx , 1                                       'set protocol to 1&lt;br /&gt;
   'the protocol value must be set BEFORE the socket is openend&lt;br /&gt;
&lt;br /&gt;
   Idx = Getsocket(idx , Sock_ipl_raw , 5000 , 0)              'RAW Socket&lt;br /&gt;
&lt;br /&gt;
   ' We try the PING 3 times (but if we get an answer we exit the for loop)&lt;br /&gt;
   Do&lt;br /&gt;
      Incr Ii&lt;br /&gt;
&lt;br /&gt;
      Result = Udpwrite(ip_sntp_server , 7 , Idx , S(1) , 9)   'write ping data               '&lt;br /&gt;
      Print &amp;quot;Ping Number : &amp;quot; ; ii&lt;br /&gt;
      Waitms 200                                               ' depending on the hops, speed, etc&lt;br /&gt;
      Result = Socketstat(idx , Sel_recv)                      'check for data&lt;br /&gt;
    '  Print &amp;quot;REC:&amp;quot; ; Result&lt;br /&gt;
      If Result &amp;gt;= 11 Then&lt;br /&gt;
&lt;br /&gt;
         Res = Tcpread(idx , R(1) , Result)                    'get data with TCPREAD !!!&lt;br /&gt;
&lt;br /&gt;
      '     Print &amp;quot;DATA RETURNED :&amp;quot; ; Res&lt;br /&gt;
      '(                     '&lt;br /&gt;
           For J = 1 To Result&lt;br /&gt;
             Print R(j) ; &amp;quot; &amp;quot; ;&lt;br /&gt;
           Next&lt;br /&gt;
            Print&lt;br /&gt;
      ')&lt;br /&gt;
            Print &amp;quot;PING OK --&amp;gt; Exit Do..Loop&amp;quot;&lt;br /&gt;
&lt;br /&gt;
            Set Ping_check_ok&lt;br /&gt;
&lt;br /&gt;
           Exit Do                                          ' If we can an answer from NTP Server exit do ... loop&lt;br /&gt;
&lt;br /&gt;
      Else&lt;br /&gt;
         Print &amp;quot;NTP Server not available&amp;quot;&lt;br /&gt;
      End If&lt;br /&gt;
      Waitms 100&lt;br /&gt;
&lt;br /&gt;
   Loop Until Ii = 3&lt;br /&gt;
&lt;br /&gt;
   Ii = 0&lt;br /&gt;
#else&lt;br /&gt;
  Dim Ping_check_ok As Bit&lt;br /&gt;
  Ping_check_ok = 1&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
'  SNTP&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
If Ping_check_ok = 1 Then                                   'When the NTP Serverer responded to PING&lt;br /&gt;
   'we need to get a socket first&lt;br /&gt;
   'note that for UDP we specify sock_dgram&lt;br /&gt;
   Idx = Getsocket(idx , Sock_dgram , 1000 , 0)                ' get socket for UDP mode, specify port&lt;br /&gt;
   Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
&lt;br /&gt;
   Local_time = Sntp(idx , Ip_sntp_server)                     ' get time from SNTP server&lt;br /&gt;
   Print &amp;quot;Local_time = &amp;quot; ; Local_time&lt;br /&gt;
&lt;br /&gt;
   If Local_time &amp;lt; 100 Then                                    'try it again&lt;br /&gt;
      Wait 1&lt;br /&gt;
      Local_time = Sntp(idx , Ip_sntp_server)                  ' get time from SNTP server&lt;br /&gt;
      Print &amp;quot;Second try ; Local_time = &amp;quot; ; Local_time&lt;br /&gt;
   End If&lt;br /&gt;
&lt;br /&gt;
   Local_time = Local_time + 3600                              ' (UTC/GMT) time + 3600&lt;br /&gt;
   Print Date(local_time) ; Spc(3) ; Time(local_time)&lt;br /&gt;
End If&lt;br /&gt;
&lt;br /&gt;
'get a socket first&lt;br /&gt;
'note that for UDP we specify sock_dgram&lt;br /&gt;
Idx = Getsocket(idx , Sock_dgram , 1000 , 0)                ' get socket for UDP mode, specify port&lt;br /&gt;
'Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Do&lt;br /&gt;
    If New_second = 1 Then&lt;br /&gt;
      Reset New_second&lt;br /&gt;
      'Do something every second ......&lt;br /&gt;
    End If&lt;br /&gt;
&lt;br /&gt;
      'The UDP header give us info about Peersize, Peerport and peeraddress&lt;br /&gt;
      'which is the amount of data bytes received from peerport and peer ip address&lt;br /&gt;
       Udpreadheader Idx                                    ' read the udp header (only the first 8 Bytes)&lt;br /&gt;
&lt;br /&gt;
      If Peersize &amp;gt; 0 Then                                  ' the actual number of bytes (without header bytes)&lt;br /&gt;
         Print &amp;quot;Size= &amp;quot; ; Peersize ; &amp;quot; By&amp;quot; ; &amp;quot;  Port= &amp;quot; ; Peerport ; &amp;quot; Sender IP= &amp;quot; ; Ip2str(peeraddress) ; &amp;quot;  Timestamp : &amp;quot; ; Date$ ; &amp;quot; / &amp;quot; ; Time$&lt;br /&gt;
           Temp = Udpread(idx , S(1) , Peersize)            ' read the number of Bytes into Array S&lt;br /&gt;
                Print &amp;quot;DATA = &amp;quot; ;&lt;br /&gt;
           For Temp = 1 To Peersize&lt;br /&gt;
              Print Chr(s(temp)) ;                          ' print what we have received over USART to debug interface&lt;br /&gt;
           Next&lt;br /&gt;
           Print&lt;br /&gt;
         'Send it back to sender IP, Sender Port&lt;br /&gt;
         Result = Udpwrite(peeraddress , Peerport , Idx , S(1) , Peersize)       ' write the received data back&lt;br /&gt;
      End If&lt;br /&gt;
Loop&lt;br /&gt;
&lt;br /&gt;
End&lt;br /&gt;
&lt;br /&gt;
Timer_irq:&lt;br /&gt;
   Incr Local_time&lt;br /&gt;
   Time$ = Time(local_time)&lt;br /&gt;
   Date$ = Date(local_time)&lt;br /&gt;
   Set New_second&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Getdatetime:&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Settime:&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Setdate:&lt;br /&gt;
Return&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Author&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
MAK3&lt;br /&gt;
&lt;br /&gt;
[[Category:Projects]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)</id>
		<title>Getting started with Arduino UNO R3 and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-08T13:29:24Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Please read first this Article:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Getting started with Arduino and WIZ820io --&amp;gt; [http://wiki.mcselec.com/Getting_started_with_Arduino_and_WIZ820io [1]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It uses the same source code exept we use here an Wiznet W5100 Chip intead of W5200 so only '''config TCPIP '''needs to be changed.&lt;br /&gt;
&lt;br /&gt;
The usage of Easy TCP/IP in combination with that example is also the same.&lt;br /&gt;
&lt;br /&gt;
== Source Code:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The difference is only this part in the Bascom source code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
'Here you need MAC address, the ip address you like to use, subnet mask, gateway and localport&lt;br /&gt;
 Config Tcpip = Noint , _&lt;br /&gt;
 Mac = 1.1.94.127.1.255 , _&lt;br /&gt;
 Ip = 192.168.2.254 , _&lt;br /&gt;
 Submask = 255.255.255.0 , _&lt;br /&gt;
 Gateway = 192.168.2.1 , _&lt;br /&gt;
 Localport = 1000 , _&lt;br /&gt;
 Tx = $55 , Rx = $55 , _&lt;br /&gt;
 Chip = W5100 , _&lt;br /&gt;
 Spi = 1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Complete Source code:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Author&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
MAK3&lt;br /&gt;
&lt;br /&gt;
[[Category:Projects]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)</id>
		<title>Getting started with Arduino UNO R3 and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-08T13:25:38Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;See first this WIKI articel:&lt;br /&gt;
&lt;br /&gt;
Getting started with Arduino and WIZ820io --&amp;gt; [http://wiki.mcselec.com/Getting_started_with_Arduino_and_WIZ820io [1]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The difference is only this part in the Bascom source code:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
'Here you need MAC address, the ip address you like to use, subnet mask, gateway and localport&lt;br /&gt;
  Config Tcpip = Noint , _&lt;br /&gt;
            Mac = 1.1.94.127.1.255 , _&lt;br /&gt;
            Ip = 192.168.2.254 , _&lt;br /&gt;
            Submask = 255.255.255.0 , _&lt;br /&gt;
            Gateway = 192.168.2.1 , _&lt;br /&gt;
            Localport = 1000 , _&lt;br /&gt;
            Tx = $55 , Rx = $55 , _&lt;br /&gt;
            Chip = W5100 , _&lt;br /&gt;
            Spi = 1&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
afsdaasdf&lt;br /&gt;
[[Category:Projects]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)</id>
		<title>Getting started with Arduino UNO R3 and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-08T13:23:42Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;See first this WIKI articel:&lt;br /&gt;
&lt;br /&gt;
Getting started with Arduino and WIZ820io --&amp;gt; [http://wiki.mcselec.com/Getting_started_with_Arduino_and_WIZ820io [1]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The difference is only this part:&lt;br /&gt;
&lt;br /&gt;
[[Category:Projects]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/Getting_started_with_Arduino_and_WIZ820io</id>
		<title>Getting started with Arduino and WIZ820io</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/Getting_started_with_Arduino_and_WIZ820io"/>
				<updated>2013-03-08T13:23:03Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;See also: [http://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)]&lt;br /&gt;
&lt;br /&gt;
== Used Bascom-AVR Version&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Bascom-AVR 2.0.7.6&lt;br /&gt;
&lt;br /&gt;
Used OS = Windows8&lt;br /&gt;
&lt;br /&gt;
== Used Hardware&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
To get started an Arduino Duemilanove board is used with an Arduino prototyping shield and prototyping jump wires&amp;lt;span id=&amp;quot;btAsinTitle&amp;quot;&amp;gt;.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span&amp;gt;To get the 3.3V for the WIZ820io power supply an voltage regulator is needed to transform the 5V from the Arduino board to 3.3V.&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(The maximum current draw from FTDI chip on the Arduino Duemilanove is max. 50mA and therefore not usable to power the WIZ820io)&lt;br /&gt;
&lt;br /&gt;
== Used Boot loader&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
You can use the Arduino boot loader but in this example an AVRISP MKII is used to flash an Bascom-AVR Bootloader.&lt;br /&gt;
&lt;br /&gt;
For this you need an AVRISP MKII and AVR Studio to flash the bootloader on the Atmega328P on the Arduino.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
&lt;br /&gt;
#Open AVR Studio 6&lt;br /&gt;
#Hit Tools &amp;gt;&amp;gt;&amp;gt; Device Programming&lt;br /&gt;
#Select AVRISP mkII under Tools and Select ATMEGA328P under devices and hit Apply button&lt;br /&gt;
#Check the BOORST fuse bit (see picture below)&lt;br /&gt;
#Flash the bootloader to Atmega328P&lt;br /&gt;
&lt;br /&gt;
[[File:Avr sdudio 6 fuse bits bootloader.PNG|frame|center|600x600px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== How to flash the bootloader&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
#Goto Memories&lt;br /&gt;
#Select the Bootloader HEX file&lt;br /&gt;
#Hit the Program button&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Avr sdudio 6 fuse bits bootloader flash.PNG|frame|center|600x600px|Avr sdudio 6 fuse bits bootloader flash.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Following you can find the Bootloader written in Bascom-AVR which works with baud rate of 57600baud:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
$crystal = 16000000 'Arduino is running at 16MHz&lt;br /&gt;
$baud = 57600 '57600 Baud&lt;br /&gt;
$timeout = 900000&lt;br /&gt;
&lt;br /&gt;
$regfile = &amp;quot;m328pdef.dat&amp;quot;&lt;br /&gt;
$loader = $3c00 'sets the bootsize to 1024 words under flash size&lt;br /&gt;
Const Pagemsb = 6 '64 words in a page reguires 6 bits&lt;br /&gt;
&lt;br /&gt;
Config Com1 = Dummy , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0&lt;br /&gt;
&lt;br /&gt;
Dim Retries As Byte&lt;br /&gt;
Dim Receivedbyte As Byte&lt;br /&gt;
Dim Kindofdata As Byte&lt;br /&gt;
Dim Spmcsrvalue As Byte&lt;br /&gt;
Dim Calculatedchecksum As Byte&lt;br /&gt;
Dim Receivedblock As Byte&lt;br /&gt;
Dim Countedblock As Byte&lt;br /&gt;
Dim Invertedblock As Byte&lt;br /&gt;
Dim Receivedchecksum As Byte&lt;br /&gt;
Dim Receivedbytes(128) As Byte&lt;br /&gt;
Dim J As Byte&lt;br /&gt;
Dim Vl As Byte&lt;br /&gt;
Dim Vh As Byte&lt;br /&gt;
Dim Wrd As Word&lt;br /&gt;
Dim Page As Word&lt;br /&gt;
Dim Z As Long&lt;br /&gt;
&lt;br /&gt;
Disable Interrupts&lt;br /&gt;
&lt;br /&gt;
Const Maxword =(2 ^ Pagemsb) * 2&lt;br /&gt;
Const Zpagemsb = Pagemsb + 1&lt;br /&gt;
Const Soh = &amp;amp;H01&lt;br /&gt;
Const Stx = &amp;amp;H02&lt;br /&gt;
Const Eot = &amp;amp;H04&lt;br /&gt;
Const Ack = &amp;amp;H06&lt;br /&gt;
Const Nak = &amp;amp;H15&lt;br /&gt;
Const Can = &amp;amp;H18&lt;br /&gt;
&lt;br /&gt;
Retries = 5&lt;br /&gt;
Testformagicbyte:&lt;br /&gt;
Receivedbyte = Waitkey()&lt;br /&gt;
Print Chr(receivedbyte);&lt;br /&gt;
If Receivedbyte = 123 Then&lt;br /&gt;
 Kindofdata = 0&lt;br /&gt;
 Goto Loader&lt;br /&gt;
Elseif Receivedbyte = 124 Then&lt;br /&gt;
 Kindofdata = 1&lt;br /&gt;
 Goto Loader&lt;br /&gt;
Elseif Receivedbyte &amp;lt;&amp;gt; 0 Then&lt;br /&gt;
 Decr Retries&lt;br /&gt;
 If Retries &amp;lt;&amp;gt; 0 Then Goto Testformagicbyte&lt;br /&gt;
End If&lt;br /&gt;
Goto _reset&lt;br /&gt;
&lt;br /&gt;
Loader:&lt;br /&gt;
Do&lt;br /&gt;
 Receivedbyte = Waitkey()&lt;br /&gt;
Loop Until Receivedbyte = 0&lt;br /&gt;
&lt;br /&gt;
If Kindofdata = 0 Then&lt;br /&gt;
 Spmcsrvalue = 3 : Gosub Do_spm&lt;br /&gt;
 Spmcsrvalue = 17 : Gosub Do_spm&lt;br /&gt;
End If&lt;br /&gt;
Retries = 10&lt;br /&gt;
&lt;br /&gt;
Do&lt;br /&gt;
 Calculatedchecksum = 0&lt;br /&gt;
 Print Chr(nak);&lt;br /&gt;
 Do&lt;br /&gt;
 Receivedbyte = Waitkey()&lt;br /&gt;
 Select Case Receivedbyte&lt;br /&gt;
 Case &amp;amp;H01: '&amp;lt;SOH&amp;gt;&lt;br /&gt;
 Incr Countedblock&lt;br /&gt;
 Calculatedchecksum = 1&lt;br /&gt;
 Receivedblock = Waitkey()&lt;br /&gt;
 Calculatedchecksum = Calculatedchecksum + Receivedblock&lt;br /&gt;
 Invertedblock = Waitkey()&lt;br /&gt;
 Calculatedchecksum = Calculatedchecksum + Invertedblock&lt;br /&gt;
 For J = 1 To 128&lt;br /&gt;
 Receivedbytes(j) = Waitkey()&lt;br /&gt;
 Calculatedchecksum = Calculatedchecksum + Receivedbytes(j)&lt;br /&gt;
 Next&lt;br /&gt;
 Receivedchecksum = Waitkey()&lt;br /&gt;
 If Countedblock = Receivedblock Then&lt;br /&gt;
 If Receivedchecksum = Calculatedchecksum Then&lt;br /&gt;
 Gosub Writepage&lt;br /&gt;
 Print Chr(ack);&lt;br /&gt;
 Else&lt;br /&gt;
 Print Chr(nak);&lt;br /&gt;
 End If&lt;br /&gt;
 Else&lt;br /&gt;
 Print Chr(nak);&lt;br /&gt;
 End If&lt;br /&gt;
 Case &amp;amp;H04: '&amp;lt;EOT&amp;gt;&lt;br /&gt;
 If Wrd &amp;gt; 0 And Kindofdata = 0 Then&lt;br /&gt;
 Wrd = 0&lt;br /&gt;
 Spmcsrvalue = 5 : Gosub Do_spm&lt;br /&gt;
 Spmcsrvalue = 17 : Gosub Do_spm&lt;br /&gt;
 End If&lt;br /&gt;
 Print Chr(ack);&lt;br /&gt;
 Waitms 20&lt;br /&gt;
 Goto _reset&lt;br /&gt;
 Case &amp;amp;H18: '&amp;lt;CAN&amp;gt;&lt;br /&gt;
 Goto _reset&lt;br /&gt;
 Case Else&lt;br /&gt;
 Exit Do&lt;br /&gt;
 End Select&lt;br /&gt;
 Loop&lt;br /&gt;
&lt;br /&gt;
 If Retries &amp;gt; 0 Then&lt;br /&gt;
 Waitms 1000&lt;br /&gt;
 Decr Retries&lt;br /&gt;
 Else&lt;br /&gt;
 Goto _reset&lt;br /&gt;
 End If&lt;br /&gt;
Loop&lt;br /&gt;
&lt;br /&gt;
Writepage:&lt;br /&gt;
If Kindofdata = 0 Then&lt;br /&gt;
 For J = 1 To 128 Step 2&lt;br /&gt;
 Vl = Receivedbytes(j)&lt;br /&gt;
 Vh = Receivedbytes(j + 1)&lt;br /&gt;
 lds r0, {vl}&lt;br /&gt;
 lds r1, {vh}&lt;br /&gt;
 Spmcsrvalue = 1 : Gosub Do_spm&lt;br /&gt;
 Wrd = Wrd + 2&lt;br /&gt;
 If Wrd = Maxword Then&lt;br /&gt;
 Wrd = 0&lt;br /&gt;
 Spmcsrvalue = 5 : Gosub Do_spm&lt;br /&gt;
 Spmcsrvalue = 17 : Gosub Do_spm&lt;br /&gt;
 Page = Page + 1&lt;br /&gt;
 Spmcsrvalue = 3 : Gosub Do_spm&lt;br /&gt;
 Spmcsrvalue = 17 : Gosub Do_spm&lt;br /&gt;
 End If&lt;br /&gt;
 Next&lt;br /&gt;
Else&lt;br /&gt;
 For J = 1 To 128&lt;br /&gt;
 Writeeeprom Receivedbytes(j) , Wrd&lt;br /&gt;
 Wrd = Wrd + 1&lt;br /&gt;
 Next&lt;br /&gt;
End If&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Do_spm:&lt;br /&gt;
 Bitwait Spmcsr.0 , Reset&lt;br /&gt;
 Bitwait Eecr.1 , Reset&lt;br /&gt;
 Z = Page&lt;br /&gt;
 Shift Z , Left , Zpagemsb&lt;br /&gt;
 Z = Z + Wrd&lt;br /&gt;
 lds r30, {Z}&lt;br /&gt;
 lds r31, {Z + 1}&lt;br /&gt;
 #if _romsize &amp;gt; 65536&lt;br /&gt;
 lds r24, {Z + 2}&lt;br /&gt;
 sts rampz, r24&lt;br /&gt;
 #endif&lt;br /&gt;
 Spmcsr = Spmcsrvalue&lt;br /&gt;
 spm&lt;br /&gt;
 nop&lt;br /&gt;
 nop&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== First &amp;quot;Hello World&amp;quot; Program&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Next Step is to flash a first Hello World program direct with Bascom-AVR:&lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
#Goto Options &amp;gt;&amp;gt;&amp;gt; Programmer in Bascom-AVR&lt;br /&gt;
#Select MCS Bootloader&lt;br /&gt;
#Select the com port of Arduino (in this case com3) and baud rate = 57600 (the same as in the bootloader program)&lt;br /&gt;
#Write the first Hello World program&lt;br /&gt;
&lt;br /&gt;
[[File:Arduino bootloader settings in bascom avr.PNG|border|center|600x600px|Arduino bootloader settings in bascom avr.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Source code for Hello World program:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
$regfile = &amp;quot;m328pdef.dat&amp;quot;&lt;br /&gt;
$crystal = 16000000 '16MHz&lt;br /&gt;
$hwstack = 60&lt;br /&gt;
$swstack = 60&lt;br /&gt;
$framesize = 60&lt;br /&gt;
&lt;br /&gt;
Config Com1 = 57600 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Do&lt;br /&gt;
&lt;br /&gt;
 Print &amp;quot;Hello World&amp;quot;&lt;br /&gt;
 Waitms 1000&lt;br /&gt;
&lt;br /&gt;
Loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
End 'end program&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Just compile this Hello World program and hit the Program Chip button or use shortcut F4 in Bascom-AVR (the programmer should be already configured before).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Then open an terminal program of your choice and connect with 57600 baud on the Arduino interface number (in this case COM3) and you will notice the&lt;br /&gt;
&lt;br /&gt;
Hello World messages coming in.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now it's time to start with WIZ820io.&lt;br /&gt;
&lt;br /&gt;
== Hardware Connections for WIZ820io&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
HARDWARE CONNECTIONS:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;1&amp;quot; cellspacing=&amp;quot;1&amp;quot; width=&amp;quot;500&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | '''WIZ820io'''&amp;lt;br/&amp;gt;&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | '''Arduino'''&amp;lt;br/&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | GND&amp;lt;br/&amp;gt;&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | GND&amp;lt;br/&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | MISO&amp;lt;br/&amp;gt;&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | MISO&amp;lt;br/&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | MOSI&amp;lt;br/&amp;gt;&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | MOSI&amp;lt;br/&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | SCK&amp;lt;br/&amp;gt;&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | SCK&amp;lt;br/&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | nSS&amp;lt;br/&amp;gt;&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | Portd.7&amp;lt;br/&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | nReset&amp;lt;br/&amp;gt;&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | Portb.2&amp;lt;br/&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | PWDN&amp;lt;br/&amp;gt;&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | &amp;lt;p style=&amp;quot;text-align: center&amp;quot;&amp;gt;GND&amp;lt;/p&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 3.3V (over additional voltage regulator)&amp;lt;br/&amp;gt;&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | 5V input for additional voltage regulator&amp;lt;br/&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | nINT&amp;lt;br/&amp;gt;&lt;br /&gt;
| style=&amp;quot;text-align: center&amp;quot; | not connected&amp;lt;br/&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== SPI and TCPIP Configuration for WIZ820io&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
At first we need to configure the SPI interface and initialize the SPI interface. Then we need a defined Reset of the WIZ820io before we configure the TCPIP Interface. Important is also the waitms 350 to give the WIZ820io time to be ready for the first command.&lt;br /&gt;
&lt;br /&gt;
Needed infos are:&lt;br /&gt;
&lt;br /&gt;
*We use noint. This is the preferred method.&lt;br /&gt;
*MAC address of WIZ820io&lt;br /&gt;
*IP address of WIZ820io&lt;br /&gt;
*Subnet Mask&lt;br /&gt;
*Gateway (e.g. Router adress)&lt;br /&gt;
*Local Port&lt;br /&gt;
*Chip is here W5200 which is used in the WIZ820io module&lt;br /&gt;
*SPI = 1. THe W5200 chip is connected with SPI.&lt;br /&gt;
*Chip select is connected with Portd.7&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = Low , Phase = 0 , Clockrate = 4 , Noss = 0&lt;br /&gt;
Spiinit&lt;br /&gt;
&lt;br /&gt;
Config Pinb.2 = Output&lt;br /&gt;
W5200_nreset Alias Portb.2&lt;br /&gt;
Reset W5200_nreset&lt;br /&gt;
Waitms 1&lt;br /&gt;
Set W5200_nreset&lt;br /&gt;
Waitms 350&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Print&lt;br /&gt;
Enable Interrupts&lt;br /&gt;
&lt;br /&gt;
 'Here you need MAC address, the ip address you like to use, subnet mask, gateway and localport&lt;br /&gt;
 Config Tcpip = Noint , _&lt;br /&gt;
 Mac = 1.1.94.127.1.255 , _&lt;br /&gt;
 Ip = 192.168.2.254 , _&lt;br /&gt;
 Submask = 255.255.255.0 , _&lt;br /&gt;
 Gateway = 192.168.2.1 , _&lt;br /&gt;
 Localport = 1000 , _&lt;br /&gt;
 Chip = W5200 , _&lt;br /&gt;
 Spi = 1 , _&lt;br /&gt;
 Cs = Portd.7&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== First Test Hardware&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
[[File:Wiz820io first test.jpg|border|none|800x800px|Wiz820io first test.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Easy TCP/IP&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The following code can be used with the Easy TCP/IP tool in Bascom-AVR under Tools &amp;gt;&amp;gt;&amp;gt; Easy TCP/IP.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the Easy TCP/IP tool you need:&lt;br /&gt;
&lt;br /&gt;
*The IP address of WIZ820io (e.g. 192.168.2.254)&lt;br /&gt;
*Local Port (e.g. 50000)&lt;br /&gt;
*Remort Port (e.g. 1000)&lt;br /&gt;
*And a text (e.g. Hello)&lt;br /&gt;
&lt;br /&gt;
Hit Setup UDP then you can send the text by klicking on SEND.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Easy tcp ip tool.PNG|border|center|600x600px|Easy tcp ip tool.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And here the Terminal Output of the following source code in combination with Easy TCP/IP:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;-----START WIZ820io Arduino Duemilanove DEMO-----&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;PING NTP Server&amp;amp;nbsp;: 192.53.103.108&amp;lt;br/&amp;gt;Ping Number&amp;amp;nbsp;: 1&amp;lt;br/&amp;gt;PING OK --&amp;gt; Exit Do..Loop&amp;lt;br/&amp;gt;Socket 0 0&amp;lt;br/&amp;gt;Local_time = 416047437&amp;lt;br/&amp;gt;08.03.13&amp;amp;nbsp;&amp;amp;nbsp; 09:43:57&amp;lt;br/&amp;gt;Size= 5 By&amp;amp;nbsp; Port= 50000 Sender IP= 192.168.2.100&amp;amp;nbsp; Timestamp&amp;amp;nbsp;: 08.03.13 / 09:44:14&amp;lt;br/&amp;gt;DATA = Hello&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Bascom-AVR source code of UDP Example which uses:&lt;br /&gt;
&lt;br /&gt;
*Ping of NTP Server&lt;br /&gt;
*Get time from NTP Server&lt;br /&gt;
*Send back the text to sender IP address (sent by Easy TCP/IP)&lt;br /&gt;
&lt;br /&gt;
== Demo Code&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
' IP Address of Arduino = 192.168.2.254&lt;br /&gt;
' Port of Arduino = 1000&lt;br /&gt;
' We use UDP&lt;br /&gt;
'&lt;br /&gt;
' HARDWARE CONNECTIONS:&lt;br /&gt;
' WIZ820 &amp;lt;-------------&amp;gt; Arduino Duemilanove&lt;br /&gt;
' GND &amp;lt;-------------&amp;gt; GND&lt;br /&gt;
' MISO &amp;lt;-------------&amp;gt; MISO&lt;br /&gt;
' MOSI &amp;lt;-------------&amp;gt; MOSI&lt;br /&gt;
' SCK &amp;lt;-------------&amp;gt; SCK&lt;br /&gt;
' nSS &amp;lt;-------------&amp;gt; PortD.7&lt;br /&gt;
' nReset &amp;lt;-------------&amp;gt; PortB.2&lt;br /&gt;
' nINT&lt;br /&gt;
' PWDN &amp;lt;-------------&amp;gt; GND&lt;br /&gt;
' 3.3V &amp;lt;-------------&amp;gt; 3.3V over additional 3.3 V Low Dropouts (LDO)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
' NTP Server IP address (here you can change the NTP server of your choice)&lt;br /&gt;
Const Ntp1 = 192 : Const Ntp2 = 53 : Const Ntp3 = 103 : Const Ntp4 = 108 ' Example = 192.53.103.108&lt;br /&gt;
&lt;br /&gt;
Const Use_ping = 1 'use PING NTP server for checking NTP server availability before move on&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
$regfile = &amp;quot;m328pdef.dat&amp;quot;&lt;br /&gt;
$crystal = 16000000 '16MHz&lt;br /&gt;
$hwstack = 100&lt;br /&gt;
$swstack = 100&lt;br /&gt;
$framesize = 400&lt;br /&gt;
&lt;br /&gt;
Config Com1 = 57600 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Server Variables&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Ip_sntp_server As Long&lt;br /&gt;
'assign the IP number of a SNTP server&lt;br /&gt;
Ip_sntp_server = Maketcp(ntp1 , Ntp2 , Ntp3 , Ntp4) 'assign IP of NTP SERVER&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Wait 2&lt;br /&gt;
Print&lt;br /&gt;
Print &amp;quot;-----START WIZ820io Arduino Duemilanove DEMO-----&amp;quot;&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Network Hardware&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = Low , Phase = 0 , Clockrate = 4 , Noss = 0&lt;br /&gt;
Spiinit&lt;br /&gt;
&lt;br /&gt;
Config Pinb.2 = Output&lt;br /&gt;
W5200_nreset Alias Portb.2&lt;br /&gt;
Reset W5200_nreset&lt;br /&gt;
Waitms 1&lt;br /&gt;
Set W5200_nreset&lt;br /&gt;
Waitms 350&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Print&lt;br /&gt;
Enable Interrupts&lt;br /&gt;
&lt;br /&gt;
 'Here you need MAC address, the ip address you like to use, subnet mask, gateway and localport&lt;br /&gt;
 Config Tcpip = Noint , _&lt;br /&gt;
 Mac = 1.1.94.127.1.255 , _&lt;br /&gt;
 Ip = 192.168.2.254 , _&lt;br /&gt;
 Submask = 255.255.255.0 , _&lt;br /&gt;
 Gateway = 192.168.2.1 , _&lt;br /&gt;
 Localport = 1000 , _&lt;br /&gt;
 Chip = W5200 , _&lt;br /&gt;
 Spi = 1 , _&lt;br /&gt;
 Cs = Portd.7&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' Config Clock&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Local_time As Long&lt;br /&gt;
Dim New_second As Bit&lt;br /&gt;
&lt;br /&gt;
Config Date = Dmy , Separator = .&lt;br /&gt;
Config Clock = User&lt;br /&gt;
&lt;br /&gt;
Config Timer1 = Timer , Prescale = 256&lt;br /&gt;
On Timer1 Timer_irq Saveall 'the SAVEALL option is NEEDED !&lt;br /&gt;
Const Timer_preload = 3036&lt;br /&gt;
Enable Timer1&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' UDP&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
Dim Idx As Byte ' socket number&lt;br /&gt;
Dim Result As Word ' result&lt;br /&gt;
Dim S(255) As Byte&lt;br /&gt;
Dim R(255) As Byte&lt;br /&gt;
Dim Sstr As String * 255&lt;br /&gt;
Dim Temp As Byte , Temp2 As Byte ' temp bytes&lt;br /&gt;
Dim Ip As Long&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' PING NTP SERVER to check if NTP server is available&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
#if Use_ping = 1&lt;br /&gt;
 Dim J As Byte , Res As Byte&lt;br /&gt;
 Dim Ii As Byte&lt;br /&gt;
 Dim Ping_check_ok As Bit&lt;br /&gt;
&lt;br /&gt;
 ' FILL PING ARRAY&lt;br /&gt;
 S(1) = 8 'type is echo&lt;br /&gt;
 S(2) = 0 'code&lt;br /&gt;
&lt;br /&gt;
 S(3) = 0 ' for checksum initialization&lt;br /&gt;
 S(4) = 0 ' checksum&lt;br /&gt;
 S(5) = 0 ' a signature can be any number&lt;br /&gt;
 S(6) = 1 ' signature&lt;br /&gt;
 S(7) = 0 ' sequence number - any number&lt;br /&gt;
 S(8) = 1&lt;br /&gt;
 S(9) = 65&lt;br /&gt;
&lt;br /&gt;
 Dim W As Word At S + 2 Overlay 'same as dta(3) and dta(4)&lt;br /&gt;
 Dim B As Byte&lt;br /&gt;
 W = Tcpchecksum(s(1) , 9) ' calculate checksum and store in dta(3) and dta(4)&lt;br /&gt;
&lt;br /&gt;
 'Ip = Maketcp(192.53.103.108) 'try to check this google server&lt;br /&gt;
 Print &amp;quot;PING NTP Server : &amp;quot; ; Ip2str(ip_sntp_server)&lt;br /&gt;
&lt;br /&gt;
 'Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
 Setipprotocol Idx , 1 'set protocol to 1&lt;br /&gt;
 'the protocol value must be set BEFORE the socket is openend&lt;br /&gt;
&lt;br /&gt;
 Idx = Getsocket(idx , Sock_ipl_raw , 5000 , 0) 'RAW Socket&lt;br /&gt;
&lt;br /&gt;
 ' We try the PING 3 times (but if we get an answer we exit the for loop)&lt;br /&gt;
 Do&lt;br /&gt;
 Incr Ii&lt;br /&gt;
&lt;br /&gt;
 Result = Udpwrite(ip_sntp_server , 7 , Idx , S(1) , 9) 'write ping data '&lt;br /&gt;
 Print &amp;quot;Ping Number : &amp;quot; ; ii&lt;br /&gt;
 Waitms 200 ' depending on the hops, speed, etc&lt;br /&gt;
 Result = Socketstat(idx , Sel_recv) 'check for data&lt;br /&gt;
 ' Print &amp;quot;REC:&amp;quot; ; Result&lt;br /&gt;
 If Result &amp;gt;= 11 Then&lt;br /&gt;
&lt;br /&gt;
 Res = Tcpread(idx , R(1) , Result) 'get data with TCPREAD !!!&lt;br /&gt;
&lt;br /&gt;
 ' Print &amp;quot;DATA RETURNED :&amp;quot; ; Res&lt;br /&gt;
 '( '&lt;br /&gt;
 For J = 1 To Result&lt;br /&gt;
 Print R(j) ; &amp;quot; &amp;quot; ;&lt;br /&gt;
 Next&lt;br /&gt;
 Print&lt;br /&gt;
 ')&lt;br /&gt;
 Print &amp;quot;PING OK --&amp;gt; Exit Do..Loop&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 Set Ping_check_ok&lt;br /&gt;
&lt;br /&gt;
 Exit Do ' If we can an answer from NTP Server exit do ... loop&lt;br /&gt;
&lt;br /&gt;
 Else&lt;br /&gt;
 Print &amp;quot;NTP Server not available&amp;quot;&lt;br /&gt;
 End If&lt;br /&gt;
 Waitms 100&lt;br /&gt;
&lt;br /&gt;
 Loop Until Ii = 3&lt;br /&gt;
&lt;br /&gt;
 Ii = 0&lt;br /&gt;
#else&lt;br /&gt;
 Dim Ping_check_ok As Bit&lt;br /&gt;
 Ping_check_ok = 1&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
' SNTP&lt;br /&gt;
'-------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
If Ping_check_ok = 1 Then 'When the NTP Serverer responded to PING&lt;br /&gt;
 'we need to get a socket first&lt;br /&gt;
 'note that for UDP we specify sock_dgram&lt;br /&gt;
 Idx = Getsocket(idx , Sock_dgram , 1000 , 0) ' get socket for UDP mode, specify port&lt;br /&gt;
 Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
&lt;br /&gt;
 Local_time = Sntp(idx , Ip_sntp_server) ' get time from SNTP server&lt;br /&gt;
 Print &amp;quot;Local_time = &amp;quot; ; Local_time&lt;br /&gt;
&lt;br /&gt;
 If Local_time &amp;lt; 100 Then 'try it again&lt;br /&gt;
 Wait 1&lt;br /&gt;
 Local_time = Sntp(idx , Ip_sntp_server) ' get time from SNTP server&lt;br /&gt;
 Print &amp;quot;Second try ; Local_time = &amp;quot; ; Local_time&lt;br /&gt;
 End If&lt;br /&gt;
&lt;br /&gt;
 Local_time = Local_time + 3600 ' (UTC/GMT) time + 3600&lt;br /&gt;
 Print Date(local_time) ; Spc(3) ; Time(local_time)&lt;br /&gt;
End If&lt;br /&gt;
&lt;br /&gt;
'get a socket first&lt;br /&gt;
'note that for UDP we specify sock_dgram&lt;br /&gt;
Idx = Getsocket(idx , Sock_dgram , 1000 , 0) ' get socket for UDP mode, specify port&lt;br /&gt;
'Print &amp;quot;Socket &amp;quot; ; Idx ; &amp;quot; &amp;quot; ; Idx&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Do&lt;br /&gt;
 If New_second = 1 Then&lt;br /&gt;
 Reset New_second&lt;br /&gt;
 'Do something every second ......&lt;br /&gt;
 End If&lt;br /&gt;
&lt;br /&gt;
 'The UDP header give us info about Peersize, Peerport and peeraddress&lt;br /&gt;
 'which is the amount of data bytes received from peerport and peer ip address&lt;br /&gt;
 Udpreadheader Idx ' read the udp header (only the first 8 Bytes)&lt;br /&gt;
&lt;br /&gt;
 If Peersize &amp;gt; 0 Then ' the actual number of bytes (without header bytes)&lt;br /&gt;
 Print &amp;quot;Size= &amp;quot; ; Peersize ; &amp;quot; By&amp;quot; ; &amp;quot; Port= &amp;quot; ; Peerport ; &amp;quot; Sender IP= &amp;quot; ; Ip2str(peeraddress) ; &amp;quot; Timestamp : &amp;quot; ; Date$ ; &amp;quot; / &amp;quot; ; Time$&lt;br /&gt;
 Temp = Udpread(idx , S(1) , Peersize) ' read the number of Bytes into Array S&lt;br /&gt;
 Print &amp;quot;DATA = &amp;quot; ;&lt;br /&gt;
 For Temp = 1 To Peersize&lt;br /&gt;
 Print Chr(s(temp)) ; ' print what we have received over USART to debug interface&lt;br /&gt;
 Next&lt;br /&gt;
 Print&lt;br /&gt;
 'Send it back to sender IP, Sender Port&lt;br /&gt;
 Result = Udpwrite(peeraddress , Peerport , Idx , S(1) , Peersize) ' write the received data back&lt;br /&gt;
 End If&lt;br /&gt;
Loop&lt;br /&gt;
&lt;br /&gt;
End&lt;br /&gt;
&lt;br /&gt;
Timer_irq:&lt;br /&gt;
 Incr Local_time&lt;br /&gt;
 Time$ = Time(local_time)&lt;br /&gt;
 Date$ = Date(local_time)&lt;br /&gt;
 Set New_second&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Getdatetime:&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Settime:&lt;br /&gt;
Return&lt;br /&gt;
&lt;br /&gt;
Setdate:&lt;br /&gt;
Return&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Author&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
MAK3&lt;br /&gt;
&lt;br /&gt;
[[Category:Projects]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)</id>
		<title>Getting started with Arduino UNO R3 and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-08T13:21:51Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;See first this WIKI articel:&lt;br /&gt;
&lt;br /&gt;
[http://wiki.mcselec.com/Getting_started_with_Arduino_and_WIZ820io]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The difference is only this part:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Projects]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)</id>
		<title>Getting started with Arduino UNO R3 and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-08T13:20:53Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;See first thisWIKI articel:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Projects]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)</id>
		<title>Getting started with Arduino UNO R3 and Ethernet Shield (W5100)</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/Getting_started_with_Arduino_UNO_R3_and_Ethernet_Shield_(W5100)"/>
				<updated>2013-03-08T13:19:02Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: Created page with &amp;quot;See first thisWIKI articel:&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;See first thisWIKI articel:&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/Getting_started_with_Arduino_UNO</id>
		<title>Getting started with Arduino UNO</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/Getting_started_with_Arduino_UNO"/>
				<updated>2013-03-08T13:00:46Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Procedure for Getting started with Arduino UNO &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;R3&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
#Download Arduino Software (which includes the USB driver for Arduino UNO and AVRDUDE)&lt;br /&gt;
#[http://arduino.cc/en/main/software http://arduino.cc/en/main/software]&lt;br /&gt;
#Create an folder Arduino e.g. C:\arduino-1.0.3&lt;br /&gt;
#Copy the Arduino files into C:\arduino-1.0.3&lt;br /&gt;
#The drivers can be found under C:\arduino-1.0.3\drivers&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; ('''not '''the FTDI USB Drivers)&lt;br /&gt;
#If the Arduino UNO was already connected then use following help [http://arduino.cc/en/Guide/UnoDriversWindowsXP http://arduino.cc/en/Guide/UnoDriversWindowsXP] which is similar to Windows7 or Windows8 procedure.&lt;br /&gt;
#AVRDUDE can be found in folder:&amp;amp;nbsp; C:\arduino-1.0.3\hardware\tools\avr\bin&lt;br /&gt;
#Configure the programmer in Bascom-AVR OPTIONS &amp;gt;&amp;gt;&amp;gt;&amp;gt; Programmer&lt;br /&gt;
#Select: External programmer&lt;br /&gt;
#Select: Hex&lt;br /&gt;
#Under Program: select the path to AVRDUDE.exe&amp;amp;nbsp;&amp;amp;nbsp; --&amp;gt;&amp;amp;nbsp; C:\arduino-1.0.3\hardware\tools\avr\bin\avrdude.exe&lt;br /&gt;
#Under Parameter use:&amp;amp;nbsp;&amp;amp;nbsp; -v -F -C c:\arduino-1.0.3\hardware\tools\avr\etc\avrdude.conf -p m328p -P '''&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;com8&amp;lt;/span&amp;gt;''' -c &amp;lt;span style=&amp;quot;color:#008000&amp;quot;&amp;gt;arduino &amp;lt;/span&amp;gt;-b 115200 -Uflash:w:{FILE}:a&lt;br /&gt;
#Change the &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;comX &amp;lt;/span&amp;gt;port to the COM port of your Arduino UNO&lt;br /&gt;
#The avrdude.conf file can be found here: c:\arduino-1.0.3\hardware\tools\avr\etc\&lt;br /&gt;
#When you want to use an Arduino UNO (not R3) then you need to change &amp;lt;span style=&amp;quot;color:#008000&amp;quot;&amp;gt;arduino &amp;lt;/span&amp;gt;to &amp;lt;span style=&amp;quot;color:#008000&amp;quot;&amp;gt;stk500&amp;lt;/span&amp;gt; (not tested info)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Arduino uno ext programmer.PNG|border|center|600x600px|Arduino uno ext programmer.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Easy Example Code&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Source code for Hello World program:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
$regfile = &amp;quot;m328pdef.dat&amp;quot;&lt;br /&gt;
$crystal = 16000000 '16MHz&lt;br /&gt;
$hwstack = 60&lt;br /&gt;
$swstack = 60&lt;br /&gt;
$framesize = 60&lt;br /&gt;
&lt;br /&gt;
Config Com1 = 57600 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Do&lt;br /&gt;
&lt;br /&gt;
 Print &amp;quot;Hello World&amp;quot;&lt;br /&gt;
 Waitms 1000&lt;br /&gt;
&lt;br /&gt;
Loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
End 'end program&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Use Program Chip (F4) for download in Bascom-AVR&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
== Terminal Output of Example:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Hello World&amp;lt;br/&amp;gt;Hello World&amp;lt;br/&amp;gt;Hello World&amp;lt;br/&amp;gt;Hello World&amp;lt;br/&amp;gt;Hello World&amp;lt;br/&amp;gt;Hello World&amp;lt;br/&amp;gt;Hello World&amp;lt;br/&amp;gt;Hello World&amp;lt;br/&amp;gt;Hello World&amp;lt;br/&amp;gt;Hello World&amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Used Versions&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Bascom-AVR 2.0.7.6&lt;br /&gt;
&lt;br /&gt;
Windows8&lt;br /&gt;
&lt;br /&gt;
== Author&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
MAK3&lt;br /&gt;
&lt;br /&gt;
[[Category:Projects]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/Getting_started_with_Arduino_UNO</id>
		<title>Getting started with Arduino UNO</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/Getting_started_with_Arduino_UNO"/>
				<updated>2013-03-08T12:58:48Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Procedure for Getting started with Arduino UNO &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;R3&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
#Download Arduino Software (which includes the USB driver for Arduino UNO and AVRDUDE)&lt;br /&gt;
#[http://arduino.cc/en/main/software http://arduino.cc/en/main/software]&lt;br /&gt;
#Create an folder Arduino e.g. C:\arduino-1.0.3&lt;br /&gt;
#Copy the Arduino files into C:\arduino-1.0.3&lt;br /&gt;
#The drivers can be found under C:\arduino-1.0.3\drivers&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; ('''not '''the FTDI USB Drivers)&lt;br /&gt;
#If the Arduino UNO was already connected then use following help [http://arduino.cc/en/Guide/UnoDriversWindowsXP http://arduino.cc/en/Guide/UnoDriversWindowsXP] which is similar to Windows7 or Windows8 procedure.&lt;br /&gt;
#AVRDUDE can be found in folder:&amp;amp;nbsp; C:\arduino-1.0.3\hardware\tools\avr\bin&lt;br /&gt;
#Configure the programmer in Bascom-AVR OPTIONS &amp;gt;&amp;gt;&amp;gt;&amp;gt; Programmer&lt;br /&gt;
#Select: External programmer&lt;br /&gt;
#Select: Hex&lt;br /&gt;
#Under Program: select the path to AVRDUDE.exe&amp;amp;nbsp;&amp;amp;nbsp; --&amp;gt;&amp;amp;nbsp; C:\arduino-1.0.3\hardware\tools\avr\bin\avrdude.exe&lt;br /&gt;
#Under Parameter use:&amp;amp;nbsp;&amp;amp;nbsp; -v -F -C c:\arduino-1.0.3\hardware\tools\avr\etc\avrdude.conf -p m328p -P '''&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;com8&amp;lt;/span&amp;gt;''' -c &amp;lt;span style=&amp;quot;color:#008000&amp;quot;&amp;gt;arduino &amp;lt;/span&amp;gt;-b 115200 -Uflash:w:{FILE}:a&lt;br /&gt;
#Change the &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;comX &amp;lt;/span&amp;gt;port to the COM port of your Arduino UNO&lt;br /&gt;
#The avrdude.conf file can be found here: c:\arduino-1.0.3\hardware\tools\avr\etc\&lt;br /&gt;
#When you want to use an Arduino UNO (not R3) then you need to change &amp;lt;span style=&amp;quot;color:#008000&amp;quot;&amp;gt;arduino &amp;lt;/span&amp;gt;to &amp;lt;span style=&amp;quot;color:#008000&amp;quot;&amp;gt;stk500&amp;lt;/span&amp;gt; (not tested info)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Arduino uno ext programmer.PNG|border|center|600x600px|Arduino uno ext programmer.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Easy Example Code&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Source code for Hello World program:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
$regfile = &amp;quot;m328pdef.dat&amp;quot;&lt;br /&gt;
$crystal = 16000000 '16MHz&lt;br /&gt;
$hwstack = 60&lt;br /&gt;
$swstack = 60&lt;br /&gt;
$framesize = 60&lt;br /&gt;
&lt;br /&gt;
Config Com1 = 57600 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Do&lt;br /&gt;
&lt;br /&gt;
 Print &amp;quot;Hello World&amp;quot;&lt;br /&gt;
 Waitms 1000&lt;br /&gt;
&lt;br /&gt;
Loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
End 'end program&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Terminal Output of Example:&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;Hello World&amp;lt;br/&amp;gt;Hello World&amp;lt;br/&amp;gt;Hello World&amp;lt;br/&amp;gt;Hello World&amp;lt;br/&amp;gt;Hello World&amp;lt;br/&amp;gt;Hello World&amp;lt;br/&amp;gt;Hello World&amp;lt;br/&amp;gt;Hello World&amp;lt;br/&amp;gt;Hello World&amp;lt;br/&amp;gt;Hello World&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Used Versions&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Bascom-AVR 2.0.7.6&lt;br /&gt;
&lt;br /&gt;
Windows8&lt;br /&gt;
&lt;br /&gt;
== Author&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
MAK3&lt;br /&gt;
&lt;br /&gt;
[[Category:Projects]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/Getting_started_with_Arduino_UNO</id>
		<title>Getting started with Arduino UNO</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/Getting_started_with_Arduino_UNO"/>
				<updated>2013-03-08T12:56:30Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Procedure for Getting started with Arduino UNO &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;R3&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
#Download Arduino Software (which includes the USB driver for Arduino UNO and AVRDUDE)&lt;br /&gt;
#[http://arduino.cc/en/main/software http://arduino.cc/en/main/software]&lt;br /&gt;
#Create an folder Arduino e.g. C:\arduino-1.0.3&lt;br /&gt;
#Copy the Arduino files into C:\arduino-1.0.3&lt;br /&gt;
#The drivers can be found under C:\arduino-1.0.3\drivers&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; ('''not '''the FTDI USB Drivers)&lt;br /&gt;
#If the Arduino UNO was already connected then use following help [http://arduino.cc/en/Guide/UnoDriversWindowsXP http://arduino.cc/en/Guide/UnoDriversWindowsXP] which is similar to Windows7 or Windows8 procedure.&lt;br /&gt;
#AVRDUDE can be found in folder:&amp;amp;nbsp; C:\arduino-1.0.3\hardware\tools\avr\bin&lt;br /&gt;
#Configure the programmer in Bascom-AVR OPTIONS &amp;gt;&amp;gt;&amp;gt;&amp;gt; Programmer&lt;br /&gt;
#Select: External programmer&lt;br /&gt;
#Select: Hex&lt;br /&gt;
#Under Program: select the path to AVRDUDE.exe&amp;amp;nbsp;&amp;amp;nbsp; --&amp;gt;&amp;amp;nbsp; C:\arduino-1.0.3\hardware\tools\avr\bin\avrdude.exe&lt;br /&gt;
#Under Parameter use:&amp;amp;nbsp;&amp;amp;nbsp; -v -F -C c:\arduino-1.0.3\hardware\tools\avr\etc\avrdude.conf -p m328p -P '''&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;com8&amp;lt;/span&amp;gt;''' -c &amp;lt;span style=&amp;quot;color:#008000&amp;quot;&amp;gt;arduino &amp;lt;/span&amp;gt;-b 115200 -Uflash:w:{FILE}:a&lt;br /&gt;
#Change the &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;comX &amp;lt;/span&amp;gt;port to the COM port of your Arduino UNO&lt;br /&gt;
#The avrdude.conf file can be found here: c:\arduino-1.0.3\hardware\tools\avr\etc\&lt;br /&gt;
#When you want to use an Arduino UNO (not R3) then you need to change &amp;lt;span style=&amp;quot;color:#008000&amp;quot;&amp;gt;arduino &amp;lt;/span&amp;gt;to &amp;lt;span style=&amp;quot;color:#008000&amp;quot;&amp;gt;stk500&amp;lt;/span&amp;gt; (not tested info)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Arduino uno ext programmer.PNG|border|center|600x600px|Arduino uno ext programmer.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Easy Example Code&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Source code for Hello World program:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
$regfile = &amp;quot;m328pdef.dat&amp;quot;&lt;br /&gt;
$crystal = 16000000 '16MHz&lt;br /&gt;
$hwstack = 60&lt;br /&gt;
$swstack = 60&lt;br /&gt;
$framesize = 60&lt;br /&gt;
&lt;br /&gt;
Config Com1 = 57600 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Do&lt;br /&gt;
&lt;br /&gt;
 Print &amp;quot;Hello World&amp;quot;&lt;br /&gt;
 Waitms 1000&lt;br /&gt;
&lt;br /&gt;
Loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
End 'end program&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Used Versions&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Bascom-AVR 2.0.7.6&lt;br /&gt;
&lt;br /&gt;
Windows8&lt;br /&gt;
&lt;br /&gt;
== Author&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
MAK3&lt;br /&gt;
&lt;br /&gt;
[[Category:Projects]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/Getting_started_with_Arduino_UNO</id>
		<title>Getting started with Arduino UNO</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/Getting_started_with_Arduino_UNO"/>
				<updated>2013-03-08T12:55:32Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Procedure for Getting started with Arduino UNO &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;R3&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
#Download Arduino Software (which includes the USB driver for Arduino UNO and AVRDUDE)&lt;br /&gt;
#[http://arduino.cc/en/main/software http://arduino.cc/en/main/software]&lt;br /&gt;
#Create an folder Arduino e.g. C:\arduino-1.0.3&lt;br /&gt;
#Copy the Arduino files into C:\arduino-1.0.3&lt;br /&gt;
#The drivers can be found under C:\arduino-1.0.3\drivers&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; ('''not '''the FTDI USB Drivers)&lt;br /&gt;
#If the Arduino UNO was already connected then use following help [http://arduino.cc/en/Guide/UnoDriversWindowsXP http://arduino.cc/en/Guide/UnoDriversWindowsXP] which is similar to Windows7 or Windows8 procedure.&lt;br /&gt;
#AVRDUDE can be found in folder:&amp;amp;nbsp; C:\arduino-1.0.3\hardware\tools\avr\bin&lt;br /&gt;
#Configure the programmer in Bascom-AVR OPTIONS &amp;gt;&amp;gt;&amp;gt;&amp;gt; Programmer&lt;br /&gt;
#Select: External programmer&lt;br /&gt;
#Select: Hex&lt;br /&gt;
#Under Program: select the path to AVRDUDE.exe&amp;amp;nbsp;&amp;amp;nbsp; --&amp;gt;&amp;amp;nbsp; C:\arduino-1.0.3\hardware\tools\avr\bin\avrdude.exe&lt;br /&gt;
#Under Parameter use:&amp;amp;nbsp;&amp;amp;nbsp; -v -F -C c:\arduino-1.0.3\hardware\tools\avr\etc\avrdude.conf -p m328p -P '''&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;com8&amp;lt;/span&amp;gt;''' -c &amp;lt;span style=&amp;quot;color:#008000&amp;quot;&amp;gt;arduino &amp;lt;/span&amp;gt;-b 115200 -Uflash:w:{FILE}:a&lt;br /&gt;
#Change the &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;comX &amp;lt;/span&amp;gt;port to the COM port of your Arduino UNO&lt;br /&gt;
#The avrdude.conf file can be found here: c:\arduino-1.0.3\hardware\tools\avr\etc\&lt;br /&gt;
#When you want to use an Arduino UNO (not R3) then you need to change &amp;lt;span style=&amp;quot;color:#008000&amp;quot;&amp;gt;arduino &amp;lt;/span&amp;gt;to &amp;lt;span style=&amp;quot;color:#008000&amp;quot;&amp;gt;stk500&amp;lt;/span&amp;gt; (not tested info)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Arduino uno ext programmer.PNG|border|center|600x600px|Arduino uno ext programmer.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Easy Example Code&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Source code for Hello World program:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
$regfile = &amp;quot;m328pdef.dat&amp;quot;&lt;br /&gt;
$crystal = 16000000 '16MHz&lt;br /&gt;
$hwstack = 60&lt;br /&gt;
$swstack = 60&lt;br /&gt;
$framesize = 60&lt;br /&gt;
&lt;br /&gt;
Config Com1 = 57600 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Do&lt;br /&gt;
&lt;br /&gt;
 Print &amp;quot;Hello World&amp;quot;&lt;br /&gt;
 Waitms 1000&lt;br /&gt;
&lt;br /&gt;
Loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
End 'end program&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Author&amp;lt;br/&amp;gt; == &lt;br /&gt;
&lt;br /&gt;
MAK3&lt;br /&gt;
[[Category:Projects]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/Getting_started_with_Arduino_UNO</id>
		<title>Getting started with Arduino UNO</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/Getting_started_with_Arduino_UNO"/>
				<updated>2013-03-08T12:51:51Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: /* Author */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Procedure for Getting started with Arduino UNO &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;R3&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
#Download Arduino Software (which included the USB driver for Arduino UNO and AVRDUDE)&lt;br /&gt;
#[http://arduino.cc/en/main/software http://arduino.cc/en/main/software]&lt;br /&gt;
#Create an folder Arduino e.g. C:\arduino-1.0.3&lt;br /&gt;
#Copy the Arduino files into C:\arduino-1.0.3&lt;br /&gt;
#The drivers can be found under C:\arduino-1.0.3\drivers&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; ('''not '''the FTDI USB Drivers)&lt;br /&gt;
#If the Arduino UNO was already connected then use following help [http://arduino.cc/en/Guide/UnoDriversWindowsXP http://arduino.cc/en/Guide/UnoDriversWindowsXP] which is similar to Windows7 or Windows8 procedure.&lt;br /&gt;
#AVRDUDE can be found in folder:&amp;amp;nbsp; C:\arduino-1.0.3\hardware\tools\avr\bin&lt;br /&gt;
#Configure the programmer in Bascom-AVR OPTIONS &amp;gt;&amp;gt;&amp;gt;&amp;gt; Programmer&lt;br /&gt;
#Select: External programmer&lt;br /&gt;
#Select: Hex&lt;br /&gt;
#Under Program: select the path to AVRDUDE.exe&amp;amp;nbsp;&amp;amp;nbsp; --&amp;gt;&amp;amp;nbsp; C:\arduino-1.0.3\hardware\tools\avr\bin\avrdude.exe&lt;br /&gt;
#Under Parameter use:&amp;amp;nbsp;&amp;amp;nbsp; -v -F -C c:\arduino-1.0.3\hardware\tools\avr\etc\avrdude.conf -p m328p -P '''&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;com8&amp;lt;/span&amp;gt;''' -c &amp;lt;span style=&amp;quot;color:#008000&amp;quot;&amp;gt;arduino &amp;lt;/span&amp;gt;-b 115200 -Uflash:w:{FILE}:a&lt;br /&gt;
#Change the &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;comX &amp;lt;/span&amp;gt;port to the COM port of your Arduino UNO&lt;br /&gt;
#The avrdude.conf file can be found here: c:\arduino-1.0.3\hardware\tools\avr\etc\&lt;br /&gt;
#When you want to use an Arduino UNO (not R3) then you need to change &amp;lt;span style=&amp;quot;color:#008000&amp;quot;&amp;gt;arduino &amp;lt;/span&amp;gt;to &amp;lt;span style=&amp;quot;color:#008000&amp;quot;&amp;gt;stk500&amp;lt;/span&amp;gt; (not tested info)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Arduino uno ext programmer.PNG|border|center|600x600px|Arduino uno ext programmer.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Easy Example Code&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Source code for Hello World program:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
$regfile = &amp;quot;m328pdef.dat&amp;quot;&lt;br /&gt;
$crystal = 16000000 '16MHz&lt;br /&gt;
$hwstack = 60&lt;br /&gt;
$swstack = 60&lt;br /&gt;
$framesize = 60&lt;br /&gt;
&lt;br /&gt;
Config Com1 = 57600 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Do&lt;br /&gt;
&lt;br /&gt;
 Print &amp;quot;Hello World&amp;quot;&lt;br /&gt;
 Waitms 1000&lt;br /&gt;
&lt;br /&gt;
Loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
End 'end program&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Author&amp;lt;br/&amp;gt; == &lt;br /&gt;
&lt;br /&gt;
MAK3&lt;br /&gt;
[[Category:Projects]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/Getting_started_with_Arduino_UNO</id>
		<title>Getting started with Arduino UNO</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/Getting_started_with_Arduino_UNO"/>
				<updated>2013-03-08T12:51:37Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Procedure for Getting started with Arduino UNO &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;R3&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
#Download Arduino Software (which included the USB driver for Arduino UNO and AVRDUDE)&lt;br /&gt;
#[http://arduino.cc/en/main/software http://arduino.cc/en/main/software]&lt;br /&gt;
#Create an folder Arduino e.g. C:\arduino-1.0.3&lt;br /&gt;
#Copy the Arduino files into C:\arduino-1.0.3&lt;br /&gt;
#The drivers can be found under C:\arduino-1.0.3\drivers&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; ('''not '''the FTDI USB Drivers)&lt;br /&gt;
#If the Arduino UNO was already connected then use following help [http://arduino.cc/en/Guide/UnoDriversWindowsXP http://arduino.cc/en/Guide/UnoDriversWindowsXP] which is similar to Windows7 or Windows8 procedure.&lt;br /&gt;
#AVRDUDE can be found in folder:&amp;amp;nbsp; C:\arduino-1.0.3\hardware\tools\avr\bin&lt;br /&gt;
#Configure the programmer in Bascom-AVR OPTIONS &amp;gt;&amp;gt;&amp;gt;&amp;gt; Programmer&lt;br /&gt;
#Select: External programmer&lt;br /&gt;
#Select: Hex&lt;br /&gt;
#Under Program: select the path to AVRDUDE.exe&amp;amp;nbsp;&amp;amp;nbsp; --&amp;gt;&amp;amp;nbsp; C:\arduino-1.0.3\hardware\tools\avr\bin\avrdude.exe&lt;br /&gt;
#Under Parameter use:&amp;amp;nbsp;&amp;amp;nbsp; -v -F -C c:\arduino-1.0.3\hardware\tools\avr\etc\avrdude.conf -p m328p -P '''&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;com8&amp;lt;/span&amp;gt;''' -c &amp;lt;span style=&amp;quot;color:#008000&amp;quot;&amp;gt;arduino &amp;lt;/span&amp;gt;-b 115200 -Uflash:w:{FILE}:a&lt;br /&gt;
#Change the &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;comX &amp;lt;/span&amp;gt;port to the COM port of your Arduino UNO&lt;br /&gt;
#The avrdude.conf file can be found here: c:\arduino-1.0.3\hardware\tools\avr\etc\&lt;br /&gt;
#When you want to use an Arduino UNO (not R3) then you need to change &amp;lt;span style=&amp;quot;color:#008000&amp;quot;&amp;gt;arduino &amp;lt;/span&amp;gt;to &amp;lt;span style=&amp;quot;color:#008000&amp;quot;&amp;gt;stk500&amp;lt;/span&amp;gt; (not tested info)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Arduino uno ext programmer.PNG|border|center|600x600px|Arduino uno ext programmer.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Easy Example Code&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Source code for Hello World program:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
$regfile = &amp;quot;m328pdef.dat&amp;quot;&lt;br /&gt;
$crystal = 16000000 '16MHz&lt;br /&gt;
$hwstack = 60&lt;br /&gt;
$swstack = 60&lt;br /&gt;
$framesize = 60&lt;br /&gt;
&lt;br /&gt;
Config Com1 = 57600 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Do&lt;br /&gt;
&lt;br /&gt;
 Print &amp;quot;Hello World&amp;quot;&lt;br /&gt;
 Waitms 1000&lt;br /&gt;
&lt;br /&gt;
Loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
End 'end program&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Author&amp;lt;br/&amp;gt; == &lt;br /&gt;
&lt;br /&gt;
[[Category:Projects]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/Getting_started_with_Arduino_UNO</id>
		<title>Getting started with Arduino UNO</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/Getting_started_with_Arduino_UNO"/>
				<updated>2013-03-08T12:51:01Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Procedure for Getting started with Arduino UNO &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;R3&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
#Download Arduino Software (which included the USB driver for Arduino UNO and AVRDUDE)&lt;br /&gt;
#[http://arduino.cc/en/main/software http://arduino.cc/en/main/software]&lt;br /&gt;
#Create an folder Arduino e.g. C:\arduino-1.0.3&lt;br /&gt;
#Copy the Arduino files into C:\arduino-1.0.3&lt;br /&gt;
#The drivers can be found under C:\arduino-1.0.3\drivers&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; ('''not '''the FTDI USB Drivers)&lt;br /&gt;
#If the Arduino UNO was already connected then use following help [http://arduino.cc/en/Guide/UnoDriversWindowsXP http://arduino.cc/en/Guide/UnoDriversWindowsXP] which is similar to Windows7 or Windows8 procedure.&lt;br /&gt;
#AVRDUDE can be found in folder:&amp;amp;nbsp; C:\arduino-1.0.3\hardware\tools\avr\bin&lt;br /&gt;
#Configure the programmer in Bascom-AVR OPTIONS &amp;gt;&amp;gt;&amp;gt;&amp;gt; Programmer&lt;br /&gt;
#Select: External programmer&lt;br /&gt;
#Select: Hex&lt;br /&gt;
#Under Program: select the path to AVRDUDE.exe&amp;amp;nbsp;&amp;amp;nbsp; --&amp;gt;&amp;amp;nbsp; C:\arduino-1.0.3\hardware\tools\avr\bin\avrdude.exe&lt;br /&gt;
#Under Parameter use:&amp;amp;nbsp;&amp;amp;nbsp; -v -F -C c:\arduino-1.0.3\hardware\tools\avr\etc\avrdude.conf -p m328p -P '''&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;com8&amp;lt;/span&amp;gt;''' -c &amp;lt;span style=&amp;quot;color:#008000&amp;quot;&amp;gt;arduino &amp;lt;/span&amp;gt;-b 115200 -Uflash:w:{FILE}:a&lt;br /&gt;
#Change the &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;comX &amp;lt;/span&amp;gt;port to the COM port of your Arduino UNO&lt;br /&gt;
#The avrdude.conf file can be found here: c:\arduino-1.0.3\hardware\tools\avr\etc\&lt;br /&gt;
#When you want to use an Arduino UNO (not R3) then you need to change &amp;lt;span style=&amp;quot;color:#008000&amp;quot;&amp;gt;arduino &amp;lt;/span&amp;gt;to &amp;lt;span style=&amp;quot;color:#008000&amp;quot;&amp;gt;stk500&amp;lt;/span&amp;gt; (not tested info)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Arduino uno ext programmer.PNG|border|center|600x600px|Arduino uno ext programmer.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Easy Example Code&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
Source code for Hello World program:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
$regfile = &amp;quot;m328pdef.dat&amp;quot;&lt;br /&gt;
$crystal = 16000000 '16MHz&lt;br /&gt;
$hwstack = 60&lt;br /&gt;
$swstack = 60&lt;br /&gt;
$framesize = 60&lt;br /&gt;
&lt;br /&gt;
Config Com1 = 57600 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Do&lt;br /&gt;
&lt;br /&gt;
 Print &amp;quot;Hello World&amp;quot;&lt;br /&gt;
 Waitms 1000&lt;br /&gt;
&lt;br /&gt;
Loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
End 'end program&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Projects]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/Getting_started_with_Arduino_UNO</id>
		<title>Getting started with Arduino UNO</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/Getting_started_with_Arduino_UNO"/>
				<updated>2013-03-08T12:50:08Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Procedure for Getting started with Arduino UNO &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;R3&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
#Download Arduino Software (which included the USB driver for Arduino UNO and AVRDUDE)&lt;br /&gt;
#[http://arduino.cc/en/main/software http://arduino.cc/en/main/software]&lt;br /&gt;
#Create an folder Arduino e.g. C:\arduino-1.0.3&lt;br /&gt;
#Copy the Arduino files into C:\arduino-1.0.3&lt;br /&gt;
#The drivers can be found under C:\arduino-1.0.3\drivers&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; ('''not '''the FTDI USB Drivers)&lt;br /&gt;
#If the Arduino UNO was already connected then use following help [http://arduino.cc/en/Guide/UnoDriversWindowsXP http://arduino.cc/en/Guide/UnoDriversWindowsXP] which is similar to Windows7 or Windows8 procedure.&lt;br /&gt;
#AVRDUDE can be found in folder:&amp;amp;nbsp; C:\arduino-1.0.3\hardware\tools\avr\bin&lt;br /&gt;
#Configure the programmer in Bascom-AVR OPTIONS &amp;gt;&amp;gt;&amp;gt;&amp;gt; Programmer&lt;br /&gt;
#Select: External programmer&lt;br /&gt;
#Select: Hex&lt;br /&gt;
#Under Program: select the path to AVRDUDE.exe&amp;amp;nbsp;&amp;amp;nbsp; --&amp;gt;&amp;amp;nbsp; C:\arduino-1.0.3\hardware\tools\avr\bin\avrdude.exe&lt;br /&gt;
#Under Parameter use:&amp;amp;nbsp;&amp;amp;nbsp; -v -F -C c:\arduino-1.0.3\hardware\tools\avr\etc\avrdude.conf -p m328p -P '''&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;com8&amp;lt;/span&amp;gt;''' -c &amp;lt;span style=&amp;quot;color:#008000&amp;quot;&amp;gt;arduino &amp;lt;/span&amp;gt;-b 115200 -Uflash:w:{FILE}:a&lt;br /&gt;
#Change the &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;comX &amp;lt;/span&amp;gt;port to the COM port of your Arduino UNO&lt;br /&gt;
#The avrdude.conf file can be found here: c:\arduino-1.0.3\hardware\tools\avr\etc\&lt;br /&gt;
#When you want to use an Arduino UNO (not R3) then you need to change &amp;lt;span style=&amp;quot;color:#008000&amp;quot;&amp;gt;arduino &amp;lt;/span&amp;gt;to &amp;lt;span style=&amp;quot;color:#008000&amp;quot;&amp;gt;stk500&amp;lt;/span&amp;gt; (not tested info)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Arduino uno ext programmer.PNG|border|center|600x600px|Arduino uno ext programmer.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Easy Example Code:&lt;br /&gt;
&lt;br /&gt;
Source code for Hello World program:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&amp;lt;source lang=&amp;quot;bascomavr&amp;quot;&amp;gt;&lt;br /&gt;
$regfile = &amp;quot;m328pdef.dat&amp;quot;&lt;br /&gt;
$crystal = 16000000 '16MHz&lt;br /&gt;
$hwstack = 60&lt;br /&gt;
$swstack = 60&lt;br /&gt;
$framesize = 60&lt;br /&gt;
&lt;br /&gt;
Config Com1 = 57600 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Do&lt;br /&gt;
&lt;br /&gt;
 Print &amp;quot;Hello World&amp;quot;&lt;br /&gt;
 Waitms 1000&lt;br /&gt;
&lt;br /&gt;
Loop&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
End 'end program&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Projects]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/Getting_started_with_Arduino_UNO</id>
		<title>Getting started with Arduino UNO</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/Getting_started_with_Arduino_UNO"/>
				<updated>2013-03-08T12:48:43Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Procedure for Getting started with Arduino UNO &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;R3&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
#Download Arduino Software (which included the USB driver for Arduino UNO and AVRDUDE)&lt;br /&gt;
#[http://arduino.cc/en/main/software http://arduino.cc/en/main/software]&lt;br /&gt;
#Create an folder Arduino e.g. C:\arduino-1.0.3&lt;br /&gt;
#Copy the Arduino files into C:\arduino-1.0.3&lt;br /&gt;
#The drivers can be found under C:\arduino-1.0.3\drivers&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; ('''not '''the FTDI USB Drivers)&lt;br /&gt;
#If the Arduino UNO was already connected then use following help [http://arduino.cc/en/Guide/UnoDriversWindowsXP http://arduino.cc/en/Guide/UnoDriversWindowsXP] which is similar to Windows7 or Windows8 procedure.&lt;br /&gt;
#AVRDUDE can be found in folder:&amp;amp;nbsp; C:\arduino-1.0.3\hardware\tools\avr\bin&lt;br /&gt;
#Configure the programmer in Bascom-AVR OPTIONS &amp;gt;&amp;gt;&amp;gt;&amp;gt; Programmer&lt;br /&gt;
#Select: External programmer&lt;br /&gt;
#Select: Hex&lt;br /&gt;
#Under Program: select the path to AVRDUDE.exe&amp;amp;nbsp;&amp;amp;nbsp; --&amp;gt;&amp;amp;nbsp; C:\arduino-1.0.3\hardware\tools\avr\bin\avrdude.exe&lt;br /&gt;
#Under Parameter use:&amp;amp;nbsp;&amp;amp;nbsp; -v -F -C c:\arduino-1.0.3\hardware\tools\avr\etc\avrdude.conf -p m328p -P '''&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;com8&amp;lt;/span&amp;gt;''' -c &amp;lt;span style=&amp;quot;color:#008000&amp;quot;&amp;gt;arduino &amp;lt;/span&amp;gt;-b 115200 -Uflash:w:{FILE}:a&lt;br /&gt;
#Change the &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;comX &amp;lt;/span&amp;gt;port to the COM port of your Arduino UNO&lt;br /&gt;
#The avrdude.conf file can be found here: c:\arduino-1.0.3\hardware\tools\avr\etc\&lt;br /&gt;
#When you want to use an Arduino UNO (not R3) then you need to change &amp;lt;span style=&amp;quot;color:#008000&amp;quot;&amp;gt;arduino &amp;lt;/span&amp;gt;to &amp;lt;span style=&amp;quot;color:#008000&amp;quot;&amp;gt;stk500&amp;lt;/span&amp;gt; (not tested info)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Arduino uno ext programmer.PNG|border|center|600x600px|Arduino uno ext programmer.PNG]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Easy Example Code:&lt;br /&gt;
&lt;br /&gt;
$regfile = &amp;quot;m328pdef.dat&amp;quot;&amp;lt;br/&amp;gt;$crystal = 16000000 '16MHz&amp;lt;br/&amp;gt;$hwstack = 60&amp;lt;br/&amp;gt;$swstack = 60&amp;lt;br/&amp;gt;$framesize = 60&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;Config Com1 = 57600 , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;Do&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;amp;nbsp;Print &amp;quot;Hello World&amp;quot;&amp;lt;br/&amp;gt;&amp;amp;nbsp;Waitms 1000&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;Loop&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;End 'end program&lt;br /&gt;
&lt;br /&gt;
[[Category:Projects]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/Getting_started_with_Arduino_UNO</id>
		<title>Getting started with Arduino UNO</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/Getting_started_with_Arduino_UNO"/>
				<updated>2013-03-08T12:47:55Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Procedure for Getting started with Arduino UNO &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt;R3&amp;lt;/span&amp;gt;&amp;lt;br/&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
#Download Arduino Software (which included the USB driver for Arduino UNO and AVRDUDE)&lt;br /&gt;
#[http://arduino.cc/en/main/software http://arduino.cc/en/main/software]&lt;br /&gt;
#Create an folder Arduino e.g. C:\arduino-1.0.3&lt;br /&gt;
#Copy the Arduino files into C:\arduino-1.0.3&lt;br /&gt;
#The drivers can be found under C:\arduino-1.0.3\drivers&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; ('''not '''the FTDI USB Drivers)&lt;br /&gt;
#If the Arduino UNO was already connected then use following help [http://arduino.cc/en/Guide/UnoDriversWindowsXP http://arduino.cc/en/Guide/UnoDriversWindowsXP] which is similar to Windows7 or Windows8 procedure.&lt;br /&gt;
#AVRDUDE can be found in folder:&amp;amp;nbsp; C:\arduino-1.0.3\hardware\tools\avr\bin&lt;br /&gt;
#Configure the programmer in Bascom-AVR OPTIONS &amp;gt;&amp;gt;&amp;gt;&amp;gt; Programmer&lt;br /&gt;
#Select: External programmer&lt;br /&gt;
#Select: Hex&lt;br /&gt;
#Under Program: select the path to AVRDUDE.exe&amp;amp;nbsp;&amp;amp;nbsp; --&amp;gt;&amp;amp;nbsp; C:\arduino-1.0.3\hardware\tools\avr\bin\avrdude.exe&lt;br /&gt;
#Under Parameter use:&amp;amp;nbsp;&amp;amp;nbsp; -v -F -C c:\arduino-1.0.3\hardware\tools\avr\etc\avrdude.conf -p m328p -P '''&amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;com8&amp;lt;/span&amp;gt;''' -c &amp;lt;span style=&amp;quot;color:#008000&amp;quot;&amp;gt;arduino &amp;lt;/span&amp;gt;-b 115200 -Uflash:w:{FILE}:a&lt;br /&gt;
#Change the &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt;comX &amp;lt;/span&amp;gt;port to the COM port of your Arduino UNO&lt;br /&gt;
#The avrdude.conf file can be found here: c:\arduino-1.0.3\hardware\tools\avr\etc\&lt;br /&gt;
#When you want to use an Arduino UNO (not R3) then you need to change &amp;lt;span style=&amp;quot;color:#008000&amp;quot;&amp;gt;arduino &amp;lt;/span&amp;gt;to &amp;lt;span style=&amp;quot;color:#008000&amp;quot;&amp;gt;stk500&amp;lt;/span&amp;gt; (not tested info)&lt;br /&gt;
&lt;br /&gt;
[[File:Arduino uno ext programmer.PNG|border|center|600x600px]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Projects]]&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	<entry>
		<id>https://wiki.mcselec.com/File:Arduino_uno_ext_programmer.PNG</id>
		<title>File:Arduino uno ext programmer.PNG</title>
		<link rel="alternate" type="text/html" href="https://wiki.mcselec.com/File:Arduino_uno_ext_programmer.PNG"/>
				<updated>2013-03-08T12:47:09Z</updated>
		
		<summary type="html">&lt;p&gt;MAK3: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>MAK3</name></author>	</entry>

	</feed>