Chit chat

—————-

After installing Cobol on the Nslu2 running Debian, still had to load some libraries after and update to Debian. A learning experience.

Got some write ups on various sites,;

Hackaday.

http://hackaday.com/2011/01/26/stepper-directed-hdtv-antenna/

Freetronics.

http://www.freetronics.com/blogs/news/8495111-using-android-tablets-as-arduino-interfaces

Electronics-lab

http://www.electronics-lab.com/blog/?p=10978

Airy08.com

http://airy08.com/id/Crossword-or-Scrabble-helper/

ocotewa01

http://ocotewa01.blogspot.com/2011/05/home-made-cannoli-forms.html

Free downloads

http://freepdfz.com/pdf/yagi-antenna-diy

—————————————————————————–

Found some of the commands on the Raspberry Pi changed a little bit The Raspberry Pi per se does not have analog ports like the Arduino. though you can get converters that can be attached to the gpio or use an r2r setup. To light an led, you will need to use at least two pins. A gpio and a ground pin. You will also need an led and an appropriate resistor. Once you master these simple steps you can additional electronics and control quite a few things. Remember the gpio only uses very low voltage. Additional safety circuitry is needed for other projects.

Note: you can use jumper wires from  older computers if you do not need to use the whole header.

old version-----------
# Turn light on
cd /sys/class/gpio
# Turn on pin but defaults to low.
echo 17 > export
# Set port direction in this case we aredoing output.
echo out > gpio17/direction
# Set pin high and turn on led.
echo 1 > gpio17/value
#Turn light off
echo 0 > gpio17/value
-----------------------------------
New version: You have to use the full path with commands.
# Turn light on
cd /sys/class/gpio
# Turn on pin but defaults to low.
echo "17" > /sys/class/gpio/export
# Set port direction in this case we are doing output.
echo "out" > /sys/class/gpio/gpio17/direction
# Set pin high and turn on led.
echo "1" > /sys/class/gpio/gpio17/value
#Turn light off
echo "0" > /sys/class/gpio/gpio17/value

Screenshot from 2013-09-27 04:41:18

—————————————————————————–

Solar energy experiment with 1n914 diodes.

Screenshot from 2013-09-26 04:24:04

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

Experimenta OTA TV antenna. Works pretty good.

Screenshot from 2013-09-24 21:33:07

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

Step 2: Message of the day,

Screenshot from 2013-09-26 04:51:32.png
Screenshot from 2013-09-26 04:47:19.png
Screenshot from 2013-09-26 05:11:50.png
Message of the day if the screen you see when you log into the command line. Usually if s short and mundane, You may want to jazz it up a little bit with some text graphics.Some of the settings for your computer are int he /etc directory. Message of the day or motd usually resides in this directory. Now if you add your meswsage or graphic to the reglar motd file, it will usually get wiped out. What you can do is add your messages ad or graphics into a file call /etc/motd.tail. Then when you log in you will see your message. You will need to reboot to see the bessage.You can also edit /etc/issue that is used by mgetty for when you log into a serial port. (rs232).

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

There are  ways you can incorporate microcontrollers for business.

Screenshot from 2013-09-26 05:47:54

An interesting chip is the cmos 4046 because it can control analog audio signals with a digital signal. Easch chip and control the flow of four audio lines. You could turn off or on the connections to say four speaker or two trditional stereos.with say just four controls lines from an Arduino or the like.

Screenshot from 2013-09-24 04:28:44

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

latest version of Reports.cgi that allows to tke the output of command line programs tot he web.

#!/bin/sh
echo “Content-type: text/html\n”

# read in our parameters
CMD=`echo “$QUERY_STRING” | sed -n ‘s/^.*cmd=\([^&]*\).*$/\1/p’ | sed “s/%20/ /g”`

FOLDER1=`echo “$QUERY_STRING” | sed -n ‘s/^.*folder1=\([^&]*\).*$/\1/p’ | sed “s/%20/ /g”| sed “s/%2F/\//g”`
FOLDER2=`echo “$QUERY_STRING” | sed -n ‘s/^.*folder2=\([^&]*\).*$/\1/p’ | sed “s/%20/ /g”| sed “s/%2F/\//g”`
FOLDER3=`echo “$QUERY_STRING” | sed -n ‘s/^.*folder3=\([^&]*\).*$/\1/p’ | sed “s/%20/ /g”| sed “s/%2F/\//g”`
FOLDER4=`echo “$QUERY_STRING” | sed -n ‘s/^.*folder4=\([^&]*\).*$/\1/p’ | sed “s/%20/ /g”| sed “s/%2F/\//g”`
FOLDER5=`echo “$QUERY_STRING” | sed -n ‘s/^.*folder5=\([^&]*\).*$/\1/p’ | sed “s/%20/ /g”| sed “s/%2F/\//g”`
FOLDER6=`echo “$QUERY_STRING” | sed -n ‘s/^.*folder6=\([^&]*\).*$/\1/p’ | sed “s/%20/ /g”| sed “s/%2F/\//g”`
FOLDER7=`echo “$QUERY_STRING” | sed -n ‘s/^.*folder7=\([^&]*\).*$/\1/p’ | sed “s/%20/ /g”| sed “s/%2F/\//g”`
FOLDER8=`echo “$QUERY_STRING” | sed -n ‘s/^.*folder8=\([^&]*\).*$/\1/p’ | sed “s/%20/ /g”| sed “s/%2F/\//g”`
FOLDER9=`echo “$QUERY_STRING” | sed -n ‘s/^.*folder9=\([^&]*\).*$/\1/p’ | sed “s/%20/ /g”| sed “s/%2F/\//g”`
FOLDERA=`echo “$QUERY_STRING” | sed -n ‘s/^.*folderA=\([^&]*\).*$/\1/p’ | sed “s/%20/ /g”| sed “s/%2F/\//g”`
FOLDERB=`echo “$QUERY_STRING” | sed -n ‘s/^.*folderB=\([^&]*\).*$/\1/p’ | sed “s/%20/ /g”| sed “s/%2F/\//g”`

# our html header
echo “<html>”
echo “<head><title>Reports console</title></head>”
echo “<body>”

# test if any parameters were passed
if [ $CMD ]
then
case “$CMD” in

horo)
echo “Horoscope for $FOLDER5:<pre>”
/var/www/cgi-bin/ghp.sh “$FOLDER5”
echo “</pre>”
;;

whoro)
echo “Weekly horoscope for $FOLDERB:<pre>”
/var/www/cgi-bin/ghwp.sh “$FOLDERB”
echo “</pre>”
;;
weather)
echo “Weather for: $FOLDER4 :<pre>”
/var/www/cgi-bin/gwp.sh “$FOLDER4”
echo “</pre>”
;;

weather1)
echo “Weather for: $FOLDER9 :<pre>”
weather-util “$FOLDER9”
echo “</pre>”
;;

weather2)
echo “Weather for: $FOLDERA :<pre>”
/var/www/cgi-bin/gwp2cl.sh “$FOLDERA”
echo “</pre>”
;;

# ggtp)
# echo “Google translation for $FOLDER6:<pre>”
# /var/www/cgi-bin/ggtp.sh “$FOLDER6” “$FOLDER1” “$FOLDER2”
# echo “</pre>”
# ;;
#
glpp)
echo “Lottery balls picks using $FOLDER7 with choices) out of $FOLDER8 ball(s).<pre>”
/var/www/cgi-bin/glpp.sh “$FOLDER7” “$FOLDER8”
echo “</pre>”
;;

gtlp)
echo “Terror threat level :<pre>”
/var/www/cgi-bin/gtlp.sh
echo “</pre>”
;;

*)
echo “Unknown command $CMD<br>”
;;
esac
fi
# print out the form

# page header
echo “<p>”
echo “<hr>”
echo “<center><h2>”
echo “Reports console for: ”
# echo “Test server”
uname -n
echo “<p>”
echo “<a href=”http://oesrvr1″&gt; Click on me to return to the homepage!</a>”
echo “</h2></center>”
echo “<hr>”
echo “<p>”
echo “<form method=get>”
echo “Choose which report you want to run: <br>”
echo “<input type=radio name=cmd value=weather > Weather (enter zip code) <input type=text name=folder4 value=22546> <br>”
echo “<input type=radio name=cmd value=weather1 > Weather (enter airport code) <input type=text name=folder9 value=FWT> <br>”
echo “<input type=radio name=cmd value=weather2 > Weather (enter zip code) <input type=text name=folderA value=22546> <br>”

echo “<input type=radio name=cmd value=horo> Horoscope (enter sign) <input type=text name=folder5 value=virgo> <br>”

echo “<input type=radio name=cmd value=whoro> Weekly horoscope (enter sign) <input type=text name=folderB value=virgo> <br>”

#
# echo “<input type=radio name=cmd value=ggtp> Google translate (enter convert from) <input type=text name=folder1 value=es> (enter convert to) <input type=text name=folder2 value=en><br> (enter word to convert) <input type=text name=folder6 value=toro><br>”
#
echo “<input type=radio name=cmd value=glpp> Lottery picks (enter # of picks) <input type=text name=folder7 value=6> (enter # of balls) <input type=text name=folder8 value=50><br>”
echo “<input type=radio name=cmd value=gtlp> Terror threat level”
echo ” <br><br>”
echo “<input type=submit>”
echo “</form>”
echo “</body>”
echo “</html>”

———————————————————-

One of the test programs I played with to relearn cobol. Cobol is so self documenting.

~$ ./readtest
7654321 Mend ed 1234 1968
1234567 Corona ra 5555 1950
:~$ cat STUDENTS.DAT
7654321Mend ed196807191234m
1234567Corona ra195006135555f
~$

~$ cat readtest.cob
IDENTIFICATION DIVISION.
PROGRAM-ID.  SeqReadNo88.
AUTHOR.  Michael Coughlan.

ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
    SELECT StudentFile ASSIGN TO "STUDENTS.DAT"
		ORGANIZATION IS LINE SEQUENTIAL.

DATA DIVISION.
FILE SECTION.
FD StudentFile.
01 StudentDetails.
   02  StudentId       PIC 9(7).
   02  StudentName.
       03 Surname      PIC X(8).
       03 Initials     PIC XX.
   02  DateOfBirth.
       03 YOBirth      PIC 9(4).
       03 MOBirth      PIC 9(2).
       03 DOBirth      PIC 9(2).
   02  CourseCode      PIC X(4).
   02  Gender          PIC X.

PROCEDURE DIVISION.
Begin.
   OPEN INPUT StudentFile
   READ StudentFile
      AT END MOVE HIGH-VALUES TO StudentDetails
   END-READ
   PERFORM UNTIL StudentDetails = HIGH-VALUES
      DISPLAY StudentId SPACE StudentName SPACE CourseCode SPACE YOBirth
      READ StudentFile
         AT END MOVE HIGH-VALUES TO StudentDetails
      END-READ
   END-PERFORM
   CLOSE StudentFile
   STOP RUN.

———————————————————-

http://en.wikipedia.org/wiki/Sous-vide

———————————————————-

Good day.

Advertisements