ENTRY 2
Introducing, ....Bumpy!After realizing that it might be a good idea to go through the tutorial projects, to improve my understanding of Technic construction methods. I decided that, since I was most interested in beginning to understand the programming aspect of robotics, I would just make my own little modifications to the starter robots(to still somewhat satisfy my constructively creative needs), and use them to take the NXC tutorial at the same time.NXC is a text based programming language for Lego Mindstorms. You can find the tutorial here. Also be sure to visit the BricxCC link by clicking on its link over in the links section. BricxCC is an IDE for NXC, and has many useful features like syntax, debugging, and more.Anyway..., back to Bumpy.Bumpy, is the "TriBot" that's the first robot your instructed how to build, with a few extras. With help from the NXT Educational Resource Set I used a larger wheel size, and new caster wheel assembly. I also made a poorly constructed "bumper" mechanism for the touch sensor, and extended the "neck" for the US sensor. I wrote a simple program in NXC that told Bumpy to move forward indefinitely until the receives input from the touch sensor. At which point he backs up, says "woops!", and then turns around and drives in a different direction.Soon I hope to post links to the code for my projects. Until then, I will include it in my posts, along with line by line explanations.--bumpy.nxc--CODE / Description#include "NXCDefs.h" /load NXC Definitions into memory.
#define MAXVOL 7 /define the term MAXVOL for use. Assign it a value of 7.
#define MINVOL 1 /define the term MINVOL for use. Assign it a value of 1.
#define MIDVOL 3 /define the term MIDVOL for use. Assign it a value of 3.
task main() /Create task.
{ /Start "main" task.
SetSensor (IN_1,SENSOR_TOUCH); /Acknowledge a Sensor(Port: 1, Type: Touch)
PlayFileEx("! Startup.rso", MAXVOL, FALSE); /Play a File(Filename, Volume, Loop?)
Wait(1500); /Wait for program to carry out previously stated function(s)
PlayFileEx("! Attention.rso", MAXVOL, FALSE); /Play a File(Filename, Volume, Loop?)
Wait(1000); /Wait for program to carry out previously stated function(s)
repeat (12) /Repeat commands listed below. (how many times?)
{ /Start "repeat" command list.
OnFwdReg(OUT_BC, 50, OUT_REGMODE_SYNC); /Move forward.(ports, power, sync motors)
until(SENSOR_1 == 1); /Interrupt previous command(s)if(touch sensor activated)
OnRevReg(OUT_BC, 40, OUT_REGMODE_SYNC); /if "until" happens - Move Backwards.
Wait(800); /Wait for program to carry out previously stated function(s)
PlayFileEx("Woops.rso", MAXVOL, FALSE); /Play a File(Filename, Volume, Loop?)
Wait(800); /Wait for program to carry out previously stated function(s)
OnRev(OUT_B, 40); /Spin Motor Backwards(port?, speed?)
OnFwd(OUT_C, 40); /Spin Motor Forwards(port?, speed?)
Wait(1000); /Wait for program to carry out previously stated function(s)
} /end "repeat" command
Off(OUT_BC); /Turn off(port?)
} /end "main" task
-Quote of the Post-
In this life, judge no one,..
but watch out for @$$holes.
- Anonymous