Chit chat

=======

Thinking of B. B. King as he as sort of a hero to me.

The cable I ordered form china came in a month early.

Time for Mercury to settle down and let things get better.

If If you are coding just to code, consider other opportunities There is a lot more to it than just slinging code unless you are just doing it for your own enjoyment. To be honest, if you go to work for a company you will not be choosing what language you use, My first real job was s a maintenance programmer. They had one programming language I was familiar with, but had to learn a completely new language to do my job. Fortunately, having used several languages, I was able to adapt. Just a grain of salt.

Regretfully downloading mswin 2 in base 1.  Taking forever. Could download and install a linux desktop and or server in a fraction of the time spent.  #MSWindows version 2
Cheap sorter box

 When is the best time to get a free computer? When marriages or couples break apart and when MSWindows users think they need a new machine because the operating system requires beefier hardware. Acquired this old P3 for free from a couple breakup. Wiped the drive and put Linux on it. #mswindows #linux #repurpose #computer

——————————————————

Remember the days of modems and bulletin boards. Nostalgia: an old bbs program. (minus the support files)


COMMON SHARED Car.ret, Car.ret$, Lfeed, Lfeed$, Mod.dem, Console
DECLARE SUB delay (Secs!)
DECLARE SUB Lout (l$, Cr!)
CONST False = 0
CONST True = -1
' ****************************************************************************
' eddiedbbs version 0.00001
' main.loop written by computothought
' some data input routines borrowed from the dumbbs program
' last update 02/06/95
start.program:
GOSUB housekeeping
WHILE NOT done
GOSUB The.main.loop
WEND
GOSUB end.of.job
END
' *****************************************************************************
' Subroutines
' -----------------------------------------------------------------------------
housekeeping:
CLS
CLOSE
done = 0
Cdmask = &H80
Carrier = 0
'Status ports should be Com1 = 3fe and Com2 = 2fe (?f8+6)
Rs232.port = &H3FE: '&H3F8 + 6
Mod.dem = 1
Console = 2
Port$ = "COM1:"
Baud$ = "300,"
Flow$ = "N,8,1": ',DS0"
Minute = 60
Char.wait.time = 4 * Minute
Char.grace.time = 1 * Minute
Lin.length = 40
Q$ = CHR$(34)
Bell$ = CHR$(7)
Car.ret = 13
Car.ret$ = CHR$(Car.ret)
Lfeed = 10
Lfeed$ = CHR$(Lfeed)
' ------------------------------------------------
' select.baud - select the baud rate
Com.spec$ = Port$ + Baud$ + Flow$
' ----------------------------------------------
' open communication lines
OPEN Com.spec$ FOR RANDOM AS #Mod.dem
GOSUB pause
OPEN "scrn:" FOR OUTPUT AS #Console
PRINT
' ---------------------------------------------
' Restart the work log file
OPEN "append", #5, "worklog"
PRINT #5, "Start of job", TIME$, DATE$
CLOSE #5
RETURN
' ------------------------------------------------
' gchar - get a character
Gchar:
Char.timeout = False
Charet = 0
T = TIMER
DO
IF NOT EOF(Mod.dem) THEN
Ceddie$ = INPUT$(1, #Mod.dem)
C = ASC(Ceddie$)
PRINT #Mod.dem, CHR$(C);
IF C <> 8 THEN
PRINT #Console, CHR$(C);
ELSE
PRINT #Console, CHR$(29);
END IF
Charet = 1
END IF
GOSUB Carchek
LOOP UNTIL TIMER > T + Char.wait.time OR Charet = 1 OR Carrier = False
IF TIMER > T + Char.wait.time THEN
a$ = Car.ret$ + Lfeed$ + Bell$ + Bell$
a$ = a$ + "This BBS will hang up if you don't press a key."
CALL Lout(a$, True)
Violation = 2
Char.timeout = True
C = 256
END IF
RETURN
' ----------------------------------------------------
' gline - get a line
Gline:
In.line$ = ""
GOSUB Clear.garbage
DO
GOSUB Gchar
SELECT CASE C
CASE IS > 255, Car.ret
REM
CASE 29, 8
In.line$ = LEFT$(In.line$, LEN(In.line$) - 1)
CASE ELSE
In.line$ = In.line$ + CHR$(C)
END SELECT
LOOP UNTIL LEN(In.line$) > Lin.length OR (C = Car.ret AND LEN(In.line$) > 0) OR C > 255 OR Carrier = False
RETURN
' -------------------------------------------------------------------------
' Dtrlow
Dtrlow:
PRINT #Mod.dem, "ATH0"
GOSUB pause
PRINT #Mod.dem, "ATZ"
GOSUB pause
RETURN
' --------------------------------------------------------------------------
' Dtrhi
Dtrhi:
PRINT #Mod.dem, "ATE0M0S0=1&C1"
GOSUB pause
RETURN
' ----------------------------------------------------------
' file download
file.download:
Dload.item$ = ""
DO WHILE UCASE$(Dload.item$) <> "0"
Usefile$ = "dir.fil"
GOSUB File.display
GOSUB Clear.garbage
GOSUB Gchar
Dload.item$ = UCASE$(CHR$(C))
DO WHILE Dload.item$ <= "Z" AND Dload.item$ >= "A"
CALL Lout("Please open your buffer now, then press any key!", True)
GOSUB File.display
GOSUB Clear.garbage
GOSUB Gchar
Usefile$ = "\ul\dload" + CHR$(C)
GOSUB File.display
CALL Lout("Please close your buffer now, then press any key!", True)
GOSUB Clear.garbage
GOSUB Gchar
LOOP
IF Carrier = False OR Char.timeout THEN EXIT DO
LOOP
RETURN
' ----------------------------------------------------------
' bulletin display
bulletins:
Bullet.item$ = ""
DO WHILE UCASE$(Bullet.item$) <> "Q"
Usefile$ = "poster"
GOSUB File.display
CALL Lout("Enter choice: ", False)
GOSUB Clear.garbage
GOSUB Gchar
Bullet.item$ = UCASE$(CHR$(C))
CALL Lout(" ", True)
DO WHILE C > 48 AND C < 57
Usefile$ = Usefile$ + Bullet.item$
GOSUB File.display
C = 256
LOOP
IF Carrier = False OR Char.timeout THEN EXIT DO
LOOP
RETURN
' ----------------------------------------------------------
' new user routine
New.user:
Usefile$ = "newuser"
GOSUB File.display
CALL Lout("Please enter a unique password: ", False)
GOSUB Gline
CALL Lout("", True)
Pass.in$ = In.line$
CLOSE #4
KILL "userfile.old"
NAME "userfile" AS "userfile.old"
OPEN "O", #6, "userfile"
Status = 4
PRINT #6, Q$; Log.name$; Q$; ","; Q$; Pass.in$; Q$; ","; Status; ","; Q$; Time.in$; Q$
CLOSE #6
OPEN "I", #7, "userfile.old"
OPEN "A", #8, "userfile"
DO WHILE NOT EOF(7)
INPUT #7, a$, B$, C, D$
PRINT #8, Q$; a$; Q$; ","; Q$; B$; Q$; ","; C; ","; Q$; D$; Q$
IF a$ = "END" THEN EXIT DO
LOOP
CLOSE #7
CLOSE #8
RETURN
' ---------------------------------------------------------
' file.display
File.display:
OPEN "I", #3, Usefile$
WHILE NOT EOF(3)
LINE INPUT #3, data.in$
CALL Lout(data.in$, True)
WEND
CLOSE #3
RETURN
' =========================================================
' The main Loop
'
' This is where the 'BBS' actually begins.
'
The.main.loop:
Restart:
VIEW PRINT
GOSUB Dtrlow
GOSUB Dtrhi
CLS
PRINT
LOCATE 2, 30: PRINT "eddied BBS version 0.001"
PRINT
Wait.for.ring:
DO
C = 256
LOCATE 3, 30
PRINT DATE$; " "; TIME$
LOCATE 4, 30
PRINT "Rs232:"; INP(Rs232.port)
GOSUB Carchek
LOOP UNTIL Carrier
' -----------------------------------------------------
' start
Mainloop:
VIEW PRINT 6 TO 25
GOSUB Clear.garbage
PRINT
' -----------------------------------------------------
' header
Usefile$ = "prelog"
GOSUB File.display
' -----------------------------------------------------
' logon
logon:
Time.in$ = TIME$
Legal = False
CALL Lout("Please enter your name: ", False)
GOSUB Gline
Log.name$ = In.line$
CALL Lout("", True)
CLOSE #4
OPEN "I", #4, "userfile"
DO WHILE NOT EOF(4)
INPUT #4, Name.in$, Pass.in$, Status, Start$
IF UCASE$(Name.in$) = UCASE$(Log.name$) OR Name.in$ = "END" THEN EXIT DO
LOOP
IF Name.in$ = "END" THEN
GOSUB New.user
ELSE
FOR xdummy = 1 TO 3
CALL Lout(" password: ", False)
GOSUB Gline
Pass.word$ = ""
Pass.word$ = In.line$
CALL Lout("", True)
IF Pass.word$ = Pass.in$ THEN
EXIT FOR
ELSEIF ((Pass.word$ <> Pass.in$) AND (xdummy > 3)) THEN
violate = 1
GOTO Logoff
END IF
NEXT xdummy
END IF
CLOSE #4
' -----------------------------------------------------
' main
menu.item$ = ""
DO WHILE UCASE$(menu.item$) <> "G"
Usefile$ = "post2"
GOSUB File.display
CALL Lout(" ", True)
CALL Lout("Your choice: ", False)
GOSUB Clear.garbage
GOSUB Gchar
menu.item$ = UCASE$(CHR$(C))
CALL Lout(" ", True)
SELECT CASE menu.item$
CASE "D"
GOSUB file.download
CASE "B"
GOSUB bulletins
CASE "G"
violate = 0
END SELECT
IF Carrier = False OR Char.timeout THEN EXIT DO
LOOP
' -----------------------------------------------------
' footer
Usefile$ = "epilog"
GOSUB File.display
' -----------------------------------------------------
' pause
pause:
FOR x = 1 TO 4000
NEXT x
RETURN
' -----------------------------------------------------
' logoff
Logoff:
OPEN "append", #5, "worklog"
PRINT #5, Name.in$, Pass.word$, Time.in$, TIME$, violate
CLOSE #5
a$ = "Logging off"
CALL Lout(a$, True)
a$ = "+++"
CALL Lout(a$, True)
T = TIMER
DO
LOOP UNTIL TIMER > 4 + T
PRINT "Turning DTR low"
GOSUB Dtrlow
CALL delay(2)
PRINT "Bringing DTR high"
GOSUB Dtrhi
CALL delay(2)
RETURN
' ------------------------------------------------------
Carchek:
CC = (INP(Rs232.port) AND Cdmask)
IF CC = 128 THEN
Carrier = True
ELSE
Carrier = False
END IF
RETURN
' ------------------------------------------------------
Clear.garbage:
IF NOT EOF(1) THEN
DO
Ceddie$ = INPUT$(1, #Mod.dem)
LOOP UNTIL EOF(Mod.dem)
END IF
RETURN
' ------------------------------------------------------
end.of.job:
OPEN "append", #5, "worklog"
PRINT #5, "End of use", TIME$, DATE$
CLOSE #5
CLOSE
RETURN
' ===========================================================================

SUB delay (Secs)
' ------------------------------------------------
' delay - wait so many seconds
delay (Secs):
T1 = TIMER
DO
LOOP UNTIL TIMER > 40 + T1
END SUB

SUB flush (Time)
' ----------------------------------------------------
' flush - flush buffer
T = TIMER
DO
IF NOT EOF(Mod.dem) THEN
Dummy$ = INPUT$(LOF(Mod.dem), #Mod.dem)
END IF
LOOP UNTIL TIMER > T + Time
END SUB

SUB Lout (l$, Cr)
' ---------------------------------------------------
' lout - line out
FOR j = 1 TO LEN(l$)
G = ASC(MID$(l$, j, 1))
PRINT #Mod.dem, CHR$(G);
PRINT #Console, CHR$(G);
NEXT j
IF Cr THEN
PRINT #Mod.dem, Car.ret$; Lfeed$
PRINT #Console, Car.ret$;
END IF
END SUB

——————————————————

From Wikipedia:

Pulse-width modulation (PWM), or pulse-duration modulation (PDM), is a technique used to encode a message into a pulsing signal. It is a type of modulation. Although this modulation technique can be used to encode information for transmission, its main use is to allow the control of the power supplied to electrical devices, especially to inertial loads such as motors. In addition, PWM is one of the two principal algorithms used in photovoltaic solar battery chargers,[1] the other being MPPT.

The average value of voltage (and current) fed to the load is controlled by turning the switch between supply and load on and off at a fast rate. The longer the switch is on compared to the off periods, the higher the total power supplied to the load.

The PWM switching frequency has to be much higher than what would affect the load (the device that uses the power), which is to say that the resultant waveform perceived by the load must be as smooth as possible. Typically switching has to be done several times a minute in an electric stove, 120 Hz in a lamp dimmer, from few kilohertz (kHz) to tens of kHz for a motor drive and well into the tens or hundreds of kHz in audio amplifiers and computer power supplies.

The term duty cycle describes the proportion of ‘on’ time to the regular interval or ‘period’ of time; a low duty cycle corresponds to low power, because the power is off for most of the time. Duty cycle is expressed in percent, 100% being fully on.

The main advantage of PWM is that power loss in the switching devices is very low. When a switch is off there is practically no current, and when it is on and power is being transferred to the load, there is almost no voltage drop across the switch. Power loss, being the product of voltage and current, is thus in both cases close to zero. PWM also works well with digital controls, which, because of their on/off nature, can easily set the needed duty cycle.

PWM has also been used in certain communication systems where its duty cycle has been used to convey information over a communications channel.

 

Most micro controllers have pwm pins on board, but you can easily generate or simulate pwm in software for systems without pwm pins. First you do not see the “1” and then you see more of it. Code compiled with freebasic fbc -lang qb [filename]


 cls
for x = 1 to 1000
    for y =1 to (1000 - x)
        locate 1,1
        ?" ";
    next y
    for a = 1 to x
        locate 1,1
        ?"1";
    next a
next x
?

end 

Here is another way using an actual led connected to the parallel port. Emu;ates the idea of the lights dimming and getting brighter.

out 888,0  turns all lights off

out 888,255  turns all lights on


cls
for x = 1 to 50

    for y =1 to x
        locate 1,1
        rem ?"1";
        out 888,255
        for z = 1 to 500000
        next z
    next y
    for a = 1 to 50 -x
        locate 1,1
        rem ?" ";
        out 888,0
        for z = 1 to 500000
        next z
    next a
next x
out 888,0

or


cls
for x = 1 to 1000
    for y =1 to (1000 - x)
        locate 1,1
        rem ?" ";
        out 888, 0
    next y
    for a = 1 to x
         locate 1,1
         rem ?"1";
         out 888,255
    next a
next x
out 888,0 

——————————————————

Oldie, but goodie: Batch file to slowly print out a text file. Perfect for a quickie teleprompter.

; then
file="$1"
else
file="-"
fi

cat "$file" | while read c ; do
echo "$c"
sleep .5
done

——————————————————

If this is a duplicate, oopss.

 

Screenshot from 2013-12-08 15:29:59.png

 

Screenshot from 2013-12-08 15:33:39.png

 

 

Screenshot from 2013-12-08 15:50:30.png

Love MPD. It is both a music player and an internet radio player. You can install this on a really old machine or a new arm based linux device. Just add an amp and  speakers and you have a new age stereo that can be controlled remotely..
Make your directories where you want your music to be and then copy them there if they are not already there. Now to inbstall the basic software. You have the program itself (mpd)and a command line player to test it.(mpc)

$sudo apt-get install mpd mpc.

Sure sure your stero and or speakers are attached to the sound card and they work. Now to test it. We will do it with a radio station if you do not have any music to t4est with.

$ mpc add http://relay3.slayradio.org:8000/
adding: http://relay3.slayradio.org:8000/

$ mpc play
You should hear the radio station out of your speakers now.

Now let’s edit the config file for file location and to allow the server to be accesed from other systems. Warning this is not secure, as your better off sshing into the machine to control it.

$ sudo vim /etc/mpd.con
Change the directory where you files are (uncomment  the line also
# Files and directories #######################################################
#
# This setting controls the top directory which MPD will search to discover the
# available audio files and add them to the daemon’s online database. This
# setting defaults to the XDG directory, otherwise the music directory will be
# be disabled and audio files will only be accepted over ipc socket (using
# file:// protocol) or streaming files over an accepted protocol.
#
# music_directory               “/var/lib/mpd/music”

If you want to access the machine remotely you will need to change the hostname to the nmae of the michine, Warning: people will be albe to telnet into the machine unless you password protect the system.
#
# This setting sets the address for the daemon to listen on. Careful attention
# should be paid if this is assigned to anything other then the default, any.
# This setting can deny access to control of the daemon. Choose any if you want
# to have mpd listen on every address
#
# For network
# bind_to_address               “localhost”

Permissions:

# Permissions #################################################################
#
# If this setting is set, MPD will require password authorization. The password
# can setting can be specified multiple times for different password profiles.
#
#password                        “password@read,add,control,admin”
#
# This setting specifies the permissions a user has who has not yet logged in.
#
#default_permissions             “read,add,control,admin”
#
###############################################################################

There are other settings, but I will let you check that out your selves..

Now to access the system form other machines. There is a client for about every system known to man. You can check them out yourself at:

Screenshot from 2013-12-08 16:25:45.png
http://mpd.wikia.com/wiki/Clients

To add a radio station, you most likely have to have a url.

Have fun

——————————————————

Couple of cartoons:

Screenshot from 2015-06-06 07:36:40

Screenshot from 2015-06-04 02:20:52

Screenshot from 2015-05-29 14:47:37

Screenshot from 2015-06-01 00:47:39

Screenshot from 2015-05-29 15:27:06

Screenshot from 2015-06-01 01:12:30

 

——-Screenshot from 2015-05-31 17:55:25———————————————–

Put your tax dollars back to work.  Obsolete #computers could be a boon for #school #science departments.There are three kinds of ports usually on microcontrollers. Digital, Serial and pwm. From computers, the digital is the parallel port. you can also use the parallel port for pwm using only a few lines of code say in even qbasic. Lastly the serial port can be adapted to interface all kinds of sensors such as for temperature. That obsolete  computer can be made  into a sous vide machine in a matter of minutes, Control leds, an rc car, or even be used as a part of a home automation project. The i486 make a nice multiple rocket launcher. It’s your tax dollars, so use it wisely. #retrocomputing

FJCVOUYGZUAFO2L.MEDIUM

P000-256-267-481-f1016

P000-256-267-481-f1016

——————————————————

Screenshot from 2015-06-08 12:33:46

Not ours but some nice files for instruction in electronics.
wget https://dl.dropboxusercontent.com/u/103847327/Lab%201.pdf
wget https://dl.dropboxusercontent.com/u/103847327/Lab%202.pdf

wget https://dl.dropboxusercontent.com/u/103847327/Lab%202%20part%202.pdf
wget https://dl.dropboxusercontent.com/u/103847327/Lab%203.pdf
wget https://dl.dropboxusercontent.com/u/103847327/Lab%204.pdf
wget https://dl.dropboxusercontent.com/u/103847327/Lab%205.pdf
wget https://dl.dropboxusercontent.com/u/103847327/Lab%206.pdf
wget https://dl.dropboxusercontent.com/u/103847327/Lab%207.pdf

wget https://dl.dropboxusercontent.com/u/103847327/Lab%208.pdf

wget https://dl.dropboxusercontent.com/u/103847327/Lab%209.pdf
wget https://dl.dropboxusercontent.com/u/103847327/Lab%2010.pdf

wget https://dl.dropboxusercontent.com/u/103847327/Lab%202%20part%202.pdf

——————————————————

PC oscilloscope or how to save yourself hundreds of dollars before you buy an oscilloscope. Pull that old PC out of the closet and make it an oscilloscope: Could of copied everything here like I usually do, but most people know how to use a hyperlink.  http://www.instructables.com/id/Simple-PC-oscilliscope/

——————————————————

Minimal to use the Arduino as a web server and that is already in a sketch
that you can use. You need to edit the code so it will work in your network. 
 
</pre>
<pre><code class="hljs cpp"><span class="hljs-preprocessor">#include <SPI.h>
#include <Ethernet.h>

/******************** ETHERNET SETTINGS ********************/

byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x85, 0xD9 };  //physical mac address
byte ip[] = { 192, 168, 0, 112 };                   // ip in lan
byte subnet[] = { 255, 255, 255, 0 };              //subnet mask
byte gateway[] = { 192, 168, 0, 1 };              // default gateway
EthernetServer server(80);                       //server port

void setup()
{
Ethernet.begin(mac,ip,gateway,subnet);     // initialize Ethernet device
server.begin();                             // start to listen for clients
pinMode(8, INPUT);                         // input pin for switch
}

void loop()
{
EthernetClient client = server.available();   // look for the client

/* a place for the code*/

delay(1);      // giving time to receive the data

/*
The following line is important because it will stop the client
and look for the new connection in the next iteration i.e
EthernetClient client = server.available();
*/
client.stop();
}</span></code></pre>
<pre></pre>
<pre><code class="hljs cpp"><span class="hljs-preprocessor">

 

 
 
Now for the code to do what you want the Arduino to do. Almost looks like
a type of cgi script. This goes in the middle of the script. Definitely 
some errors in this case.

 

client.println(<span class="hljs-string">"HTTP/1.1 200 OK"</span>);
client.println(<span class="hljs-string">"Content-Type: text/html"</span>);
client.println(<span class="hljs-string">"Connnection: close"</span>);
client.println();

<span class="hljs-comment">/*
This portion is the webpage which will be
sent to client web browser one can use html , javascript
and another web markup language to make particular layout
*/</span>

client.println(<span class="hljs-string">"<!DOCTYPE html>"</span>);    <span class="hljs-comment">//web page is made using html</span>
client.println(<span class="hljs-string">"<html>"</span>);
client.println(<span class="hljs-string">"<head>"</span>);
client.println(<span class="hljs-string">"<title>Ethernet Tutorial</title>"</span>);
client.println(<span class="hljs-string">"<meta http-equiv=\"refresh\" content=\"1\">"</span>);

<span class="hljs-comment">/*
The above line is used to refresh the page in every 1 second
This will be sent to the browser as the following HTML code:
<meta http-equiv="refresh" content="1">
content = 1 sec i.e assign time for refresh
*/</span>

client.println(<span class="hljs-string">"</head>"</span>);
client.println(<span class="hljs-string">"<body>"</span>);
client.println(<span class="hljs-string">"<h1>A Webserver Tutorial </h1>"</span>);
client.println(<span class="hljs-string">"<h2>Observing State Of Switch</h2>"</span>);

client.print(<span class="hljs-string">"<h2>Switch is:  </2>"</span>);

<span class="hljs-keyword">if</span> (digitalRead(<span class="hljs-number">8</span>))
{
client.println(<span class="hljs-string">"<h3>ON</h3>"</span>);
}
<span class="hljs-keyword">else</span>
{
client.println(<span class="hljs-string">"<h3>OFF</h3>"</span>);
}

client.println(<span class="hljs-string">"</body>"</span>);
client.println(<span class="hljs-string">"</html>"</span>);</pre>
<pre><code class="hljs cpp">

 

This what the code might look like all put back together and have made 
a few changes.

 

</pre>
<pre><code class="hljs cpp">#include <SPI.h>
#include <Ethernet.h>
/******************** ETHERNET SETTINGS ********************/

byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x85, 0xD9 };  //physical mac address
byte ip[] = { 192, 168, 1, 112 };                   // ip in lan
byte subnet[] = { 255, 255, 255, 0 };              //subnet mask
byte gateway[] = { 192, 168, 1, 1 };              // default gateway
EthernetServer server(80);                       //server port

void setup()
{
Ethernet.begin(mac,ip,gateway,subnet);     // initialize Ethernet device
server.begin();                             // start to listen for clients
pinMode(8, INPUT);                         // input pin for switch
}

void loop()
{
EthernetClient client = server.available();   // look for the client

// send a standard http response header

client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connnection: close");
client.println();

/*
This portion is the webpage which will be
sent to client web browser one can use html , javascript
and another web markup language to make particular layout
*/

client.println("<!DOCTYPE html>");    //web page is made using html
client.println("<html>");
client.println("<head>");
client.println("<title>Ethernet Tutorial</title>");
client.println("<meta http-equiv=\"refresh\" content=\"1\">");

/*
The above line is used to refresh the page in every 1 second
This will be sent to the browser as the following HTML code:
<meta http-equiv="refresh" content="1">
content = 1 sec i.e assign time for refresh
*/

client.println("</head>");
client.println("<body>");
client.println("<h1>A Webserver Tutorial </h1>");
client.println("<hr>");

client.println("<h2>Observing State Of Switch</h2>");
client.println("<center>");
client.println("<table border='1'>");
client.println("<td>");
client.println("<tr>");
client.println("<td>");
client.print("<h2>Switch is:  </h2>");
client.println("</td>");
client.println("<td>");
if (digitalRead(8))
{
client.println("<h3>ON</h3>");
}
e</code><code class="hljs cpp"><code class="hljs cpp"> </code><code class="hljs cpp"> </code><code class="hljs cpp">---</code>lse
{
client.println("<h3>OFF</h3>");
}
client.println("</td>");
client.println("</tr>");
client.println("</table>");
client.println("</center>");
client.println("</body>");
client.println("</html>");

delay(1);      // giving time to receive the data

/*
The following line is important because it will stop the client
and look for the new connection in the next iteration i.e
EthernetClient client = server.available();
*/
client.stop();

}</code></pre>
<pre><code class="hljs cpp">

——————————————————

Ideas on holding several Raspberry Pi’s together,

 

or put them into individually stackable cases

——————————————————

Compatible to computer networks.

What is the ESP8266?

The ESP8266, is a cheap WiFi module which you can address using the UART protocol. It’s been featured on Hackaday and other DIY electronics blogs very recently, and lots of DIY electronics tinkers are very excited at the doors this module opens for their projects. The module is:
Small Footprint
Easy to integrate with (using UART)
Takes care of all other overheads for getting WiFi up-and-running (TCP/IP Stack etc…)
. . . and, perhaps more importantly than all the other factors, very cheap – it can be purchased from China in a quantity of one for less than £4 !

There are no market equivalents for the DIY community – the XBee has been a popular choice for adding WiFi to DIY projects up until now, but the ESP8266 module is close to one tenth the price making it easily accessible for all types of low cost applications.

The ESP8266 is the name of the chip it’s self manufactured by a company called Espressif, but it is sold in modules manufactured in China which look as seen below,

The module can be addressed using a series of AT commands. These are simple commands sent UART at 115200 baud. For example, once the module is wired up, you can send the command

AT+RST will perform a software reset on the device. AT+CWLAPwill displat all of the currently available WiFi networks etc. – simple enough!
How do I set up the ESP8266 Module?

Here is a simple pin-out for the module (the pin numbers are defined in the table
and relate to the image):

Pin Number Pin Function Pin Number Pin Function
1 RX 5 GPIO2
2 VCC 6 CH_PD
3 GPIO0 7 GND
4 RST 8 TX

Note: Under normal operation Pin 6 (CH_PD) should be tied high (3V3) to ensure correct operation

As such, you can easily wire up the module to an Arduino or just a simple USB to serial converter and start sending AT commands (Remember: RX on the module joins to TX on the connection device and vice versa!).
What are the drawbacks of using this module?

As we’ve seen above, this is shaping up to be a very good value-for-money solution for adding WiFi capabilities to DIY projects, so what are the limitations.
The module is rather ‘power thirsty’. The current supplied via USB to an Arduino is barely enough to power this module. Other websites have recommended that you should have easily 1A available, but I have not measured this myself. This makes integrating the module slightly more tricky as a second, separate voltage regulator is required and it also rules out any battery powered projects.
It is temperamental – I’ve had a chance to play with this module, and although it works most of the time, all of the sample code I have found provides far from a solid solution – there are plenty of quirks to using it.

Code examples:  https://github.com/esp8266/Arduino/archive/esp8266-sdk-1.0.zip

Adding support for the esp8266 in the arduino ide 1.6.4 Depending on the speed of your internet connection how long it will take

Installing with Boards Manager

Starting with 1.6.4, Arduino allows installation of third-party platform packages using Boards Manager. We have packages available for Windows, Mac OS, and Linux (32 and 64 bit). The 1.7.3 version did not have this option.

  • Install Arduino 1.6.4 from the Arduino website.
  • Start Arduino and open Perferences window.
  • Enter http://arduino.esp8266.com/package_esp8266com_index.json into Additional Board Manager URLs field. You can add multiple URLs, separating them with commas.
  • Open Boards Manager from Tools > Board menu and install esp8266 platform (and don’t forget to select your ESP8266 board from Tools > Board menu after installation).

 

 

——————————————————

Something cool. (Salt helps it cool faster),

Good day

Advertisements