Friday, September 27, 2013

RPi Gpio update.

 
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 are doing 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 of bash gpio: 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

Yet another chit chat.

After installing Cobol on the Nslu2 running Debian, still had to load some libraries after and update to Debian. A learning experience.
 One of the test programs I played with to relearn cobol. Cobol is so self documenting.
~$ ./readtest
6543218 Mend ed 1234 1957
1234567 Corona ra 5555 1958
:~$ cat STUDENTS.DAT
6543218Mend ed  195707141234m
1234567Corona ra195806135555f
~$
~$ 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.
-----------------------------------------
Got some write ups on various sites,;
Hackaday.
Freetronics.
Electronics-lab
Airy08.com
ocotewa01
Free downloads
—————————————————————————–
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

Simple pie chart with Qbasic/Freebasic.

Just something to play with.




DIM Angle(1)
DIM MyData(0 TO 4)
DIM C(1 TO 4)

Pi = 4 * ATN(1)                                                   '  Can use 3.141593

Radius = 200                                                      '  Change these to suit your taste 
Xc = 319                                                          '  x coordinate of center of circle
Yc = 239                                                          '  y coordinate of center of circle

FOR i = 1 TO 4                                                    '  puts data in array,
  READ MyData(i)                                                  '  with the sum in  MyData(0)
  MyData(0) = MyData(0) + MyData(i)                               '
  READ C(i)                                                       '  sets colors
NEXT                                                              '

 ' Put your data here:  (use  Value, Color)
DATA 23,1                                                       
DATA 174,2
Data 17,3
DATA 48,4

SCREEN 12                                                          ' graphics mode with ok resolution

Angle(0) = 0                                                       ' Set initial angle

FOR i = 1 TO 4
  IF i = 4 THEN                                                    ' Set final angle of wedge
    Angle(1) = 2 * Pi
  ELSE
    Angle(1) = Angle(0) + 2 * Pi * MyData(i) / MyData(0)
  END IF

  FOR j = 0 TO 1   ''' Draw sides of wedges.  Neg sign on Radius because CIRCLE flips y coordinates
    LINE (Xc, Yc)-STEP(Radius * COS(Angle(j)), -Radius * SIN(Angle(j))), C(i)     
  NEXT                                                                            

  CIRCLE (Xc, Yc), Radius, C(i), Angle(0), Angle(1)                ' Draw arc

  AvgAngle = (Angle(1) + Angle(0)) / 2                             ' find middle of wedge and paint
  PAINT (Xc + Radius * COS(AvgAngle) / 2, Yc - Radius * SIN(AvgAngle) / 2), C(i)  

  Angle(0) = Angle(1)                                              ' update initial angle
NEXT
Input "",a

Server script.

Wrote this script a while back to use the server to get information for me. Here is a newer incarnation of that same script.

#!/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>”

Server script.

Wrote this script a while back to use the server to get information for me. Here is a newer incarnation of that same script.

#!/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>”

Motd

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 message  or graphic to the regular 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 message.You can also edit /etc/issue that is used by mgetty for when you log into a serial port. (rs232).

Sunday, September 22, 2013

Emergency Usb condom.

Emergency Usb condom.


Screenshot from 2013-09-22 23:58:26.png

Screenshot from 2013-09-22 23:26:08.png
Connecting your phone or other computing device to an unknown usb port could get your device hacked. Protect yourself with a usb condomso data lines do not get connected to a nefarious host while charging. getting an usb extender bable from the dollar store is the easiest way to statr making one.

Emergency Usb condom.

Emergency Usb condom.

Connecting your phone or other computing device to an unknown usb port could get your device hacked. Protect yourself with a usb condomso data lines do not get connected to a nefarious host while charging. getting an usb extender bable from the dollar store is the easiest way to statr making one.

Thursday, September 19, 2013

Weather report.



My stepfather was into meteorology. In fact, he was a weatherman in the military, He got us into it. So I like to look at a minimal weather report. Batch files make it easier for servers to display data as needed. Have an nslu2 running linux with very low resources. So a batch file is perfect for grabbing data off the web. You can also use it for mobile devices.  That also means you can insert the data grabbed into a database for later research,






Actually I have been doing weather scraping for a while, This is probably almost the tenth script I have written.  From the command line it might look like this:

~$ ./gwp2.sh 22546
The weather for 22546 on Sep 19:
   Updated: 7:05 AM EDT on September 19, 2013
   Observed at Mantico Hill, Beaverdam, Virginia
   Temperature         47.8°F / 8.8°C
   Humidity            98%
   Dew Point           47°F / 8°C
   Windchill           48°F / 9°C
   Wind Gust           0.0 mph / 0.0 km/h
   Pressure            30.19 in / 1022 hPa (Rising)
   Conditions          Mostly Cloudy
   Visibility          10.0 miles / 16.1 kilometers
   UV                  0.0 out of 16
   Clouds              Mostly Cloudy (BKN) : 5500 ft / 1676 m
   Yesterday's Maximum 74°F / 23°C
   Yesterday's Minimum 49°F / 9°C
   Sunrise             6:55 AM EDT
   Sunset              7:11 PM EDT
   Moon Rise           7:09 PM EDT
   Moon Set            7:01 AM EDT
   Moon Phase          Moon Phase
                       Full Moon
   Raw METAR           METAR KEZF 191055Z AUTO 00000KT 10SM BKN055 10/10 A3019 RMK AO2 T00950095

~$ 

The script to grab the data is fairly straight forward.  You pull the whole page off the web and then extract data as needed.

[code]
zip=$1
tmon=$(date +"%b")
tday=$(date +"%d")
echo "The weather for $zip on $tmon $tday:"
lynx -width 1000 -dump "http://m.wund.com/cgi-bin/findweather/getForecast?brand=mobile&query=$zip" > weather
cat weather | grep "Updated"
cat weather | grep "Observed"
cat weather | grep "Temperature"
cat weather | grep "Humidity"
cat weather | grep " Dew Point"
cat weather | grep "Wind" | head -1
cat weather | grep "Wind Gust" | head -1
cat weather | grep "Pressure"
cat weather | grep "Conditions" | head -1
cat weather | grep "Visibility"
cat weather | grep "UV"
cat weather | grep "Clouds"
cat weather | grep "Yesterday's Maximum"
cat weather | grep " Yesterday's Minimum"
cat weather | grep "Sunrise"
cat weather | grep "Sunset"
cat weather | grep "Moon Rise"
cat weather | grep "Moon Set"
cat weather | grep -A1 "Moon Phase"
cat weather | grep "Raw METAR"
[/code]

Note on arch linux use he -a argument on all the grep commands. example:

cat weather | grep -a "Raw METAR"

Hope this litte program helps someone.

-----------------------------------------------------------------------------

Server version: (cgi-bin)

zip=$1
tmon=$(date +"%b")
tday=$(date +"%d")
echo  "The weather for $zip on $tmon $tday:"
lynx -width 1000 -dump  "http://m.wund.com/cgi-bin/findweather/getForecast?brand=mobile&query=$zip" > /tmp/weather
cat /tmp/weather | grep "Updated"
cat /tmp/weather | grep "Observed"
cat /tmp/weather | grep "Temperature"
cat /tmp/weather | grep "Humidity"
cat /tmp/weather | grep " Dew Point"
cat /tmp/weather | grep "Wind" | head -1
cat /tmp/weather | grep "Wind Gust" | head -1
cat /tmp/weather | grep "Pressure"
cat /tmp/weather | grep "Conditions"  | head -1
cat /tmp/weather | grep "Visibility"
cat /tmp/weather | grep "UV"
cat /tmp/weather | grep "Clouds"
cat /tmp/weather | grep "Yesterday's Maximum"
cat /tmp/weather | grep "Yesterday's Minimum"
cat /tmp/weather | grep "Sunrise"
cat /tmp/weather | grep "Sunset"
cat /tmp/weather | grep "Moon Rise"
cat /tmp/weather | grep "Moon Set"
cat /tmp/weather | grep -A1 "Moon Ph
cat /tmp/weather | grep "Raw METAR"


Monday, September 16, 2013

Do you know what time it is?

Couple of simple command line clocks.

Couple of simple clocks. Great for giving an old pc something to do for grins. Actually I was running these two programs from the nslu2 arm based unit running debian linux.

To install:

$ sudo apt-get install sysvbanner figlet

If your system does not have figlet you can get it from the web.

$ wget ftp://ftp.figlet.org/pub/figlet/program/unix/figlet-2.2.5.tar.gz
$ tar zxvf  figlet-2.2.5.tar.gz
$ cd figlet-2.2.5/
$ make
$ sudo make install

Usage:

watch -tn 1 date +%T \|figlet -c

or

watch -t -n 1 "date +%T | xargs banner"

Mswindows legacy drivers on linux

Install an MsWindows driver on linux.

General linux has drivers for everything know to man, but because of propritary interference or hardware is not used anymore, you may still be able to get it working. Had some old wifi cards in the closet that I wanted to use for a Honeypot server. Linux did not have the drivers, but it did see the hards in hardware listings. I download the MSWindows driver and in minutes the card was usuable.

Set up a legacy mswindows wifi card in linux..(Make sure your card was installed properly while the machine was off.)
Download and extract the mswindows drivers for the card
Unzip the files to a local directory
$ unzip aw*
Fw1130.bin FwRad17.bin radio17.bin TNET1130.INF
FwRad16.bin radio16.bin tnet1130.cat tnet1130.sys
Install the interfacing software.
$ sudo apt-get install ndiswrapper-common ndiswrapper-utils-1.9 install ndiswrapper-dkms
To see if your card is tetected.
$ lspci
00:0b.0 Network controller: Texas Instruments ACX 111 54Mbps Wireless Interface
$ sudo modprobe  ndiswrapper
wlan1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DORMANT qlen 1000
Install wifi card driver (driver will usually be a .INF file
$ sudo ndiswrapper -i TNET1130.INF
$ ndiswrapper -l
tnet1130 : driver installed
device (104C:9066) present
Set ip ip for the card
$ ip addr
link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
Check the current config of your card.
$ iwconfig
wlan1 IEEE 802.11g ESSID:off/any
Mode:Managed Frequency:2.412 GHz Access Point: Not-Associated
Bit Rate:54 Mb/s Tx-Power:10 dBm Sensitivity=0/3
RTS thr:off Fragment thr:off
Power Management:off
Link Quality:0 Signal level:0 Noise level:0
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
From here you should be able to configure your card.

Thursday, September 12, 2013

More arduino


More arduino test curcuits:

Ping sensor.

ping_bb.png
Screenshot from 2013-08-28 17:32:39.png
Use pin 7 for data.
/* Ping))) SensorThis sketch reads a PING))) ultrasonic rangefinder and returns the
distance to the closest object in range. To do this, it sends a pulse
to the sensor to initiate a reading, then listens for a pulse
to return.  The length of the returning pulse is proportional to
the distance of the object from the sensor.The circuit:
* +V connection of the PING))) attached to +5V
* GND connection of the PING))) attached to ground
* SIG connection of the PING))) attached to digital pin 7http://www.arduino.cc/en/Tutorial/Pingcreated 3 Nov 2008
by David A. Mellis
modified 30 Aug 2011
by Tom IgoeThis example code is in the public domain.*/// this constant won’t change.  It’s the pin number
// of the sensor’s output:
const int pingPin = 7;void setup() {
// initialize serial communication:
Serial.begin(9600);
}void loop()
{
// establish variables for duration of the ping,
// and the distance result in inches and centimeters:
long duration, inches, cm;// The PING))) is triggered by a HIGH pulse of 2 or more microseconds.
// Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
pinMode(pingPin, OUTPUT);
digitalWrite(pingPin, LOW);
delayMicroseconds(2);
digitalWrite(pingPin, HIGH);
delayMicroseconds(5);
digitalWrite(pingPin, LOW);// The same pin is used to read the signal from the PING))): a HIGH
// pulse whose duration is the time (in microseconds) from the sending
// of the ping to the reception of its echo off of an object.
pinMode(pingPin, INPUT);
duration = pulseIn(pingPin, HIGH);
// convert the time into a distance
inches = microsecondsToInches(duration);
cm = microsecondsToCentimeters(duration);
Serial.print(inches);
Serial.print(“in, “);
Serial.print(cm);
Serial.print(“cm”);
Serial.println();
delay(100);
}
long microsecondsToInches(long microseconds)
{
// According to Parallax’s datasheet for the PING))), there are
// 73.746 microseconds per inch (i.e. sound travels at 1130 feet per
// second).  This gives the distance travelled by the ping, outbound
// and return, so we divide by 2 to get the distance of the obstacle.
// See: http://www.parallax.com/dl/docs/prod/acc/28015-PING-v1.3.pdf
return microseconds / 74 / 2;
}
long microsecondsToCentimeters(long microseconds)
{
// The speed of sound is 340 m/s or 29 microseconds per centimeter.
// The ping travels out and back, so to find the distance of the
// object we take half of the distance travelled.
return microseconds / 29 / 2;
}
Servo
sweep_bb.png
Screenshot from 2013-08-28 17:34:42.png
use pin 9 for data.
// Sweep
// by BARRAGAN <http://barraganstudio.com&gt;
// This example code is in the public domain.#include <Servo.h>Servo myservo;  // create servo object to control a servo
// a maximum of eight servo objects can be createdint pos = 0;    // variable to store the servo positionvoid setup()
{
myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}void loop()
{
for (pos = 0; pos < 180; pos += 1)  // goes from 0 degrees to 180 degrees
{                                  // in steps of 1 degree
myservo.write(pos);              // tell servo to go to position in variable ‘pos’
delay(15);                       // waits 15ms for the servo to reach the position
}
for(pos = 180; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees
{
myservo.write(pos);              // tell servo to go to position in variable ‘pos’
delay(15);                       // waits 15ms for the servo to reach the position
}
}

Pir sensor

PIR-Arduino_hookup.png
rspirsensor.jpg
Screenshot from 2013-08-28 17:48:27.png
Use pin 2 for data..
/*
* PIR sensor tester
*/int ledPin = 13;                // choose the pin for the LED
int inputPin = 2;               // choose the input pin (for PIR sensor)
int pirState = LOW;             // we start, assuming no motion detected
int val = 0;                    // variable for reading the pin statusvoid setup() {
pinMode(ledPin, OUTPUT);      // declare LED as output
pinMode(inputPin, INPUT);     // declare sensor as inputSerial.begin(9600);
}void loop(){
val = digitalRead(inputPin);  // read input value
if (val == HIGH) {            // check if the input is HIGH
digitalWrite(ledPin, HIGH);  // turn LED ON
if (pirState == LOW) {
// we have just turned on
Serial.println(“Motion detected!”);
// We only want to print on the output change, not state
pirState = HIGH;
}
} else {
digitalWrite(ledPin, LOW); // turn LED OFF
if (pirState == HIGH){
// we have just turned of
Serial.println(“Motion ended!”);
// We only want to print on the output change, not state
pirState = LOW;
}
}
)
———————————————————–

Waste not want not.

Decided to make a pizza rather than order one in. You can get yeast that does not need any rising time.
Screenshot from 2013-09-09 20:21:08
But the I realized I was out of sauce so we made the red sauce.
Screenshot from 2013-09-09 17:37:01
But then I remembered  there was no cheese either. milk to the rescue.
Screenshot from 2013-09-09 19:22:13
Everything you needed for pizza. But what to do with the milk whey left over from the cheese making. no problem we just made polenta. We made of pot of it for what the stores sell a small tube.














SUNP0099
If course we used the extra red sauce and cheese for the topping on the polenta. We also added green peas for color. Hmmm good.