Wednesday, September 3, 2008

Robotics 3000X

Last night, I went to the second night of MARS, and learnt about robot computer systems (embedded software, embedded systems, etc.) and made a realistic traffic light set with a Parallax BASIC Stamp II. The lights did everything that real traffic lights did (apart from sense traffic). The code for it is below:

' {$STAMP BS2}
' {$PBASIC 2.5}
' A realistic traffic light simulator
' Coded by RubyGuy and Perlguy
' All code Copyright 2008 by RubyGuy and Perlguy under the GNU General Public Licence
' A lot simpler than the complicated state-driven example, but it can be broken down into states if you wanted to
' Created at MARS at Massey University, School of Engineering and Advanced Technology, Wellington Campus, Week 2


'|--Initialisation--|
pushbtn PIN 0
pedred PIN 1
pedgreen PIN 2
vred PIN 3
vyel PIN 4
vgreen PIN 5
btndown CON 0
i VAR Byte
INPUT pushbtn
OUTPUT pedred
OUTPUT pedgreen

'|--Set default lights on--|
HIGH pedred
HIGH pedgreen
LOW vgreen
HIGH vyel
HIGH vred

'|--Main loop--|
trafficlights:
'|--If the pedestrian presses the button--|
IF pushbtn=btndown THEN buttondown
GOTO trafficlights

'|--Executes when a pedestrian presses button--|
buttondown:
LOW pedred 'Pedestrian red on
PAUSE 3000
HIGH vgreen 'Vehicle green off
LOW vyel 'Vehicle yellow on
PAUSE 3000 'Give cars a chance to slow down
HIGH vyel 'Vehicle yellow off
LOW vred 'Vehicle stop light on
PAUSE 1000 'Give cars a chance to stop
LOW pedgreen 'Pedestrian green on
HIGH pedred 'Pedestrian red off
PAUSE 5000 'Give pedestrians time to cross
HIGH pedgreen 'Pedestrian green off
GOTO flash 'Make red man flash

'|--Flashing man effect - don't start crossing--|
flash:
FOR i = 1 TO 8 'Flash eight times
LOW pedred
PAUSE 500
HIGH pedred
PAUSE 500
NEXT

'|--Set appropriate lights on and off--|
LOW pedred
PAUSE 2000
HIGH vred
LOW vgreen
PAUSE 5000
HIGH pedred
'|--Go back to beginning--|
GOTO trafficlights
'|--We are cool--|
'|--Perl, Python, Ruby and Parallax Inc FTW!--|

Sunday, August 31, 2008

Robotics 3000! Cool!

On Wednesday, I attended the first meeting of MARS (MAssey Robotics Society), and it was AWESOME!!! We caught the train in to Wellington, and then had to basically run to Massey, but it was worth it. The first half-hour to hour was spent on Health and Safety (oh, great.) We then watched a video about how Silicon chips are made, and then got given FREE food! Awesome!
After break, we learnt about transistors and diodes, and made a light following robot. It is pretty awesome, if you ask me. It has two modes, one where it sits there waiting for light, then follows it if you shine light at it, and the other mode is where is spins around until is sees light, and then follows it. Awesome!
Next week, we will be looking at robot computer systems, e.g. Single-board computers and microcontrollers
P.S. The BMW 7-series uses 53 microcontrollers.

Monday, August 25, 2008

Robotics 2.0b

Today, I received the best e-mail message in the world – one that said I was accepted into the MARS – MAssey Robotics Society – a robotics group being started at the University. Basically, for 6-7 weeks we go there and do robotics for 4 hours. After the 6-7 weeks are up, there are open-ended robotics projects running indefinitely. Cool!
"Hello all
Congratulations on being accepted into the first Training Programme of the
Massey Robot Society. We are looking forward to meeting you and getting some
amazing projects under way."


And the best thing:
"As MARS runs for 4 hours, we suspect you may get a little hungry, so there
will be light refreshments available at around 5-5.30pm."

Sunday, August 24, 2008

V Lemon day

So, at school I sell energy drinks to junkies (even though I am one myself, and regularly drink my own stock) and Lambda and I were sitting up the front in Maths, drinking a Lemon flavoured V energy drink (Go to site) and the teacher found out. She took out wonderful nectar off us, and put them on her desk. Possessing another three in my bag, I proceeded to take one out for Lambda and give it to him. Upon seeing this, the teacher threatened to tip out our precious drinks, so we stopped. I like V.

Perl/Tk!!

By the way, I am 16 and live in NZ. Lambda is one of my friends, and I have a twin, known as RubyGuy. The three of us are the Open Source Musketeers! It's so cool. We even have a song! I will post it here when we have finished it.

Anyway, here is my first Perl/Tk script.

use English;
require Tk;
use Tk;

my $version="1.0";
my $main=MainWindow->new();
$main->minsize( qw(250 250));
$main->title("Hello");
my $hellolabel=$main->Label (-text=>"JavaNoob is such a noob :-")->pack(-side=>"top", -anchor=>"nw");
my $hellobutton=$main->Button (-text=>"Hello!")->pack(-side=>"top", -anchor=>"nw");
MainLoop();

!!Robotics!!

YAY! A few days ago, a true PICAXE genius came and visited our school, and I spent FOUR HOURS learning how to program the PICAXE and interface electronics to it. It was legendary. and I made a KITT scanner (with only 4 LEDs, blue ones though) and at the end of the day, made a robot that drove around, playing the first two bars of Slayer's Raining Blood. It was legendary. I'll probably recreate it and take a video of it, and post it on Youtube. So cool!

Java Noob

There is a person in our computing class, who thinks he is good at Java, but he is just a Java noob. He is very annoying. He will now be addressed as JavaNoob.