## Binary Calculator

We have just finished our new project: an NXT Binary Calculator built with a single NXT 2.0 kit and some standard 4×2 LEGO bricks (actually, anything with colors will do). We have both designed and programmed the robot (using RobotC).

Here are some pictures of the Calculator:

First of all, to understand how the robot works, you have to know what binary numbers are.

A binary number is written using only two different digits (0, 1) whereas the decimal system uses ten (0 to 9).

To see how it is written, let’s take an example: 10010110 (which in fact is 150 in decimal).

Every digit represents a power of two. The first digit from the right is multiplied by 2^0, the second is multiplied by 2^1 and so on.

Thus, this number is equals to: 1*2^7 + 0*2^6 + 0*2^5 + 1*2^4 + 0*2^3 + 1*2^2 + 1*2^1 + 0*2^0 = 128 + 16 + 4 + 2 = 150 (this also equals 1 * 10^2 + 5 * 10^1 + 0 * 10^0)

Here, we will use an 8 bit number which uses up to 8 digits. The biggest number will be 255 (11111111 in binary) and the smallest will be 0 (00000000 in binary).

To represent the number and operations (which will be ADD, SUBTRACT, MULTIPLY and DIVIDE), we will use a color code which is as follows:

• RED = 1
• BLUE = 0
• BLUE = SUBTRACT
• YELLOW = MULTIPLY
• WHITE = DIVIDE

The LEGO Color sensor will read the colors and convert them to numbers or operations after the user inputs numbers and operator as follows:

By default, the Color Sensor will read 0 and if there is no operation it will show “None” and end the program. The NXT screen will show information such as the read number (first in decimal, then in binary) and the total (first in decimal, then in binary). It will also show what it is reading. Please note that the Total can exceed 255 and can be less that 0.

This is a video showing the robot in action:

You can download the LDD file here (.7z) or here (.zip) and the RobotC source-code here. I have broken the robot into several groups within the LDD file, it should be fairly trivial to reassemble it using the pictures.

All comments are welcome and if you wish to contact me, you can send me an e-mail at duvit47@gmail.com.

## NXT-G to RobotC

Can RobotC do everything NXT-G can?

I’ve decided to put RobotC to the test by “translating” every program you can find in NXT-G to RobotC.

I’ve built, programmed and tested every robot using the two programming languages. You can download the RobotC programs here (.7z) or here (.zip).

I think this could help new RobotC users since it shows them how to put a simple code together. That is why I used several different programming techniques while translating. (use of synchronising motors, switches etc.)

I have put several comments to help newbies understand how the program works.

While doing this, I had encountered several problems that might be of interest to RobotC developers:

– nMotorEncoderTarget isn’t very precise while running at hight speed (other methods such as the while(nMotorEncoder < Target) cause the same issues).

– When you stop a motor, it takes a lot of time to stop while running at hight speed.

– The timers aren’t very precise (try and test the RobogatorJaw.c program with both powers at 75).

All this shows us many things, such as:

-RobotC can indeed do what NXT-G can.

-RobotC is less precise than NXT-G but RobotC developers are still working on RobotC for constant improvement.

If you want more NXT software comparisions, you might want to see this.

## Shooter

August 15, 2010 1 comment

This is our first project using the NXTcam v3 from mindsensors.com.

The aim of this bot is to find and shoot down three red targets. It’s programmed with RobotC.

The design is the Multi-Bot by Dave Parker from nxtprograms.com (except for the NXTcam module and the LEGO Color Sensor). It can be built using a single NXT 2.0 set plus the NXTcam v3.

Here are some pictures and a video of the robot:

The robot searches and detects red targets made out of LEGOs, it then moves into position as follows:

– It aims at the center of the target

– It moves forward or backward until the height of the target is right.

If the robot hits anything with the two bumpers, it will move out of the way. The robot will turn on a different LED on the Color Sensor depending on the situation:

-Green while searching.

-Blue while aiming.

-Red while firing (blinking at first).

All comments are welcome and if you wish to contact me, you can send me an e-mail at duvit47@gmail.com.

## Welcome

Hi all and welcome to our blog,

We will show you all of our projects in this blog, and we hope you will enjoy it here,

regards,

DRV47 and Odysseus, a.k.a DUVIT