(Translation: Welcome to coding, everyone! On this episode of Beginning Robotics, we will go over coding!)
Yes, finally, we're into coding robots. You may be asking, why are all those 1's and 0's up there in somewhat of a rectangular shape? It's because it's binary, one of the most common types of coding/code. There's likes of your C++ and ASCII and Java, but binary is a basic. Other than servo motors and buttons and all that math, code is where the robot really shines. One of the most basic programs that I have coded/programmed into my main brick was the sound function. While the speakers are a bit crap, they're still available to use at your disposal. Watch the video below to see what I mean. Reminder to turn up your volume so you can hear it "OK".
When you open up the NXT GUI (Graphic User Interface), you will have programming blocks on the left hand side. These programming blocks serve some type of function, whether it be movement, audio recognition, playback of said audio, so on and so forth.
"NXT-G programs are made up of programming blocks. Each programming block represents a different type of action. Each programming block is configurable. Programming blocks have a plain, easy to understand, English names and are used to formulate the programming logic in NXT-G programs" (Ford 107) These "blocks" have tabs when you click on them, to reveal more advanced programming blocks, such as sensors, actions, flow, etc. Actions, or "action programming blocks" they come under the Complete Palette in the Action group to execute specific actions. (Ford 112)
I do want to mention the Bluetooth actions. If you choose to use those, you'll need a Bluetooth dongle that plugs into your computer or wireless Bluetooth control built into your laptop. If you do not have the latter, you will need to spend extra money to use Bluetooth functions.
Some of the more fun stuff comes in with sensors. On my Race Car example of last post, and the next one, the program uses a color sensor to either speed up, slow down, stop, or turn left or right. As you would think, the color sensor senses COLORZ, ALL OF THEM, at least all on the RGB spectrum. Red 255, Green 255, Blue 255, and any color made out of those values from 0-255.
The move block is what moves things in the program. One of the servo motors acquires information from the "ethernet" cables and is told when to steer, specifically over a certain color. Yes, the race car used the color sensor as said above, but it's a necessity. How's a robot ought to function without being able to move?
The Sound Block, as shown in the video below, is used to play sounds, or record them in certain cases. While the audio editor in the GUI says you can have up to 10 seconds of audio, you are only allowed 5, and comes out of the bad speakers. But hey, would you rather have somewhat decent sound, or no sound at all?
Data Hubs and Wires- Data hubs are projections that slide down from bottom left of a programming block (Ford 162). These data hubs have input and output plugs. These data streams retrieve and send data from the sensors/motors to the main brick, vice verse.
After I show off the Race Car, what would you like me to program? I'm open for requests and your request will be made into a blog post.
GUI:
The move block is what moves things in the program. One of the servo motors acquires information from the "ethernet" cables and is told when to steer, specifically over a certain color. Yes, the race car used the color sensor as said above, but it's a necessity. How's a robot ought to function without being able to move?
The Sound Block, as shown in the video below, is used to play sounds, or record them in certain cases. While the audio editor in the GUI says you can have up to 10 seconds of audio, you are only allowed 5, and comes out of the bad speakers. But hey, would you rather have somewhat decent sound, or no sound at all?
Data Hubs and Wires- Data hubs are projections that slide down from bottom left of a programming block (Ford 162). These data hubs have input and output plugs. These data streams retrieve and send data from the sensors/motors to the main brick, vice verse.
After I show off the Race Car, what would you like me to program? I'm open for requests and your request will be made into a blog post.
GUI:
Sound Video from first post
Citation:
Ford, Jerry Lee. Lego Mindstorms NXT 2.0 for Teens. Boston, MA: Course Technology PTR, 2011. Print.
I'm not really a person that was extremely advanced in robotics, however, I've written code for a few flash games and helped mod game servers in the past.
ReplyDeleteThat's pretty cool, dude.
Delete