Things used in this project

Hardware components:
A000066 iso both
Arduino UNO & Genuino UNO
×1
1sheeld%20android%20low%20quality
1Sheeld (Android shield for Arduino)
×1
Software apps and online services:
Ide web
Arduino IDE

Schematics

Robot Chassis
Author
https://grabcad.com/library/chassis-of-a-2wd-autonomous-robot-1
Chassis.SLDPRT

Code

Robot control codeArduino
Differential drive robot code
/*

Gamepad Shield Example

This example shows an application on 1Sheeld's gamepad shield.

OPTIONAL:
To reduce the library compiled size and limit its memory usage, you
can specify which shields you want to include in your sketch by
defining CUSTOM_SETTINGS and the shields respective INCLUDE_ define.

*/

int ledPin = 13;
#define CUSTOM_SETTINGS
/* Use the game pad */
#define INCLUDE_GAMEPAD_SHIELD

/* Include 1Sheeld library. */
#include <OneSheeld.h>
#include <AFMotor.h>

// Motor objects, motor number on the motor shield board
AF_DCMotor motorLeft(1);
AF_DCMotor motorRight(2);

void setup()
{
	/* Start communication. */
	OneSheeld.begin();

	// The LED just works as an indicator that the 1Sheeld is working fine
	pinMode(ledPin, OUTPUT);

	motorLeft.setSpeed(100);
	motorRight.setSpeed(100);
}

void loop()
{
	/* Always check the status of gamepad buttons. */
	if (GamePad.isDownPressed())
	{
		motorLeft.run(BACKWARD);
		motorRight.run(BACKWARD);


		digitalWrite(ledPin, HIGH);
	}
	else if (GamePad.isUpPressed())
	{
		motorLeft.run(FORWARD);
		motorRight.run(FORWARD);
		digitalWrite(ledPin, HIGH);
	}
	else if (GamePad.isLeftPressed())
	{
		motorLeft.run(BACKWARD);
		motorRight.run(FORWARD);
		digitalWrite(ledPin, HIGH);
	}
	else if (GamePad.isRightPressed())
	{
		motorLeft.run(FORWARD);
		motorRight.run(BACKWARD);
		digitalWrite(ledPin, HIGH);
	}
	else
	{
		motorLeft.run(RELEASE);
		motorRight.run(RELEASE);
		digitalWrite(ledPin, LOW);
	}
}
Modified code for v2.3 library by Garry GerwerArduino
Created by Garry Grewer, this code works for the newer version of the motor shield v2.3
/*Gamepad Shield Example
This example shows an application on 1Sheeld's gamepad shield.

******* This is modified to use the adafruit motorshield V2.3 *********

OPTIONAL:
To reduce the library compiled size and limit its memory usage, you
can specify which shields you want to include in your sketch by
defining CUSTOM_SETTINGS and the shields respective INCLUDE_ define.*/

int ledPin = 13;
#define CUSTOM_SETTINGS
/* Use the game pad /
/ Include 1Sheeld library. */
#define INCLUDE_GAMEPAD_SHIELD
#include <OneSheeld.h>
//#include <AFMotor.h>
#include <Adafruit_MotorShield.h> //for v2.3 motorshield

Adafruit_MotorShield AFMS = Adafruit_MotorShield();

// Motor objects, motor number on the motor shield board
Adafruit_DCMotor *myMotor = AFMS.getMotor(1);
Adafruit_DCMotor *myOtherMotor = AFMS.getMotor(2);

void setup()
{
/* Start communication. */
OneSheeld.begin();
AFMS.begin();

// The LED just works as an indicator that the 1Sheeld is working fine
pinMode(ledPin, OUTPUT);
myMotor->setSpeed(150);
myOtherMotor->setSpeed(150);

}
void loop()
{
/* Always check the status of gamepad buttons. */
if (GamePad.isDownPressed())
{
myMotor->run(BACKWARD);
myOtherMotor->run(BACKWARD);

digitalWrite(ledPin, HIGH);
}
else if (GamePad.isUpPressed())
{
myMotor->run(FORWARD);
myOtherMotor->run(FORWARD);
digitalWrite(ledPin, HIGH);
}
else if (GamePad.isLeftPressed())
{
myMotor->run(BACKWARD);
myOtherMotor->run(FORWARD);
digitalWrite(ledPin, HIGH);
}
else if (GamePad.isRightPressed())
{
myMotor->run(FORWARD);
myOtherMotor->run(BACKWARD);
digitalWrite(ledPin, HIGH);
}
else
{
myMotor->run(RELEASE);
myOtherMotor->run(RELEASE);
digitalWrite(ledPin, LOW);
}
}

Credits

Msp
Ahmed Hamdy

Open Source <3 , Software Engineer , Arduino lover, Made In Alex robotics team member, Technical team, IEEE AlexSB,

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Bluetooth Controlled Car
Easy
  • 59
  • 3

Full instructions

It's a basic 4 wheel drive car which can be controlled by android phones.

Ambient 2 click board on Arduino101
Easy
  • 31
  • 2

Protip

Short article about testing Mikroelektronika Ambient 2 click board on the Arduino 101 microcontroler

Happy birthday melody on Arduino Nano with 3-way polyphony
Easy
  • 1,341
  • 20

Full instructions

Playing polyphony Happy birthday theme on Arduino Nano with three buzzers on a single mini breadboard.

Kaleidoscope Infinity Mirror
Easy
  • 2,848
  • 28

Full instructions

Build a beautiful “infinity mirror” Illusion that you can control by changing this mirrors' orientation. Rotate for changing colors!

Grove starter kit for arduino - piezo vibration sensor
Easy
  • 190
  • 4

Protip

teaches you how to use the piezo vibration sensor in the Arduino Grove starter kit.

ProjectsCommunitiesContestsLiveJobsBetaFree StoreBlogAdd projectSign up / Login
Respect project