static int command_mem_dump(int argc, char **argv)
{
	uint32_t address, i, num = 1;
	char *e;
	enum format fmt = FMT_WORD;

	if (argc > 1) {
		if ((argv[1][0] == '.') && (strlen(argv[1]) == 2)) {
			switch (argv[1][1]) {
			case 'b':
				fmt = FMT_BYTE;
				break;
			case 'h':
				fmt = FMT_HALF;
				break;
			case 's':
				fmt = FMT_STRING;
				break;
			default:
				return EC_ERROR_PARAM1;
			}
			argc--;
			argv++;
		}
	}

	if (argc < 2)
		return EC_ERROR_PARAM_COUNT;

	address = strtoi(argv[1], &e, 0);
	if (*e)
		return EC_ERROR_PARAM1;

	if (argc >= 3)
		num = strtoi(argv[2], &e, 0);

	for (i = 0; i < num; i++) {
		show_val(address, i, fmt);
		/* Lots of output could take a while.
		 * Let other things happen, too */
		if (!(i % 0x100)) {
			watchdog_reload();
			usleep(10 * MSEC);
		}
	}
	ccprintf("\n");
	cflush();
	return EC_SUCCESS;
}
int main() {
	int result;
	ClearTick();
	printf("This program is free software. You can redistribute it and/or modify it under the terms of \nthe GNU General Public License as published by the Free Software Foundation; version 3 of the License. \nRead the license at: http://www.gnu.org/licenses/gpl.txt\n\n");
	BrickPi.Address[0] = 1;
	BrickPi.Address[1] = 2;

	result = BrickPiSetup();
	printf("BrickPiSetup: %d\n", result);
	BrickPi.SensorType       [I2C_PORT]    = TYPE_SENSOR_I2C;
	BrickPi.SensorI2CSpeed   [I2C_PORT]    = I2C_SPEED;
	BrickPi.SensorI2CDevices [I2C_PORT]    = 1;

	BrickPi.SensorSettings   [I2C_PORT][0] = 0;  
	BrickPi.SensorI2CAddr    [I2C_PORT][0] = 0x02;	//address for writing

	BrickPiSetupSensors();
	struct button b1;
	b1=init_psp(b1);
	while(1)
	{
		//Send 0x42 to get a response back
		BrickPi.SensorI2CWrite [I2C_PORT][0]    = 1;	//number of bytes to write
		BrickPi.SensorI2CRead  [I2C_PORT][0]    = 6;	//number of bytes to read
		BrickPi.SensorI2COut   [I2C_PORT][0][0] = 0x42;	//byte to write
		BrickPiUpdateValues();
		printf("%d %d %d\n",BrickPi.SensorI2CIn[I2C_PORT][0][0],BrickPi.SensorI2CIn[I2C_PORT][0][1],BrickPi.SensorI2CIn[I2C_PORT][0][2]);
		b1=upd(b1,I2C_PORT);		//Update the button values
		show_val(b1);		//#Show the values 
							//To use the button values in you own program just call it, 
							//eg x=b.ljx will fetch and store the value of the Left Joystick position in the X-axis in the variable x
		b1=init_psp(b1);			//Initialize all buttons to 0
		usleep(100000);	//Give a delay of 100ms
	}
	return 0;
}