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

Microsoft Student Partner, C# programmer, 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

Red Balloon
Easy
  • 599
  • 10

Full instructions

This is a great project you can make with your kids to raise their awareness to air pollution.

Playing smartphone games with a relay touch board
Easy
  • 296
  • 5

I played smartphone games with a relay touch board.

Arduino/Genuino 101 BLE Thermometer With TMP102 and Blynk
Easy
  • 593
  • 10

Full instructions

Here is how to make an Arduino/Genuino 101 Bluetooth Low Energy thermometer with TMP102 and Blynk.

Motion Sensor Water Gun
Easy
  • 30
  • 1

Full instructions

Soak your unsuspecting friends with a motion-activated water gun!

Motion Sensor Water Gun

Team Engineering Is Easy

Simple Digital Arduino Clock Without RTC
Easy
  • 1,758
  • 8

Work in progress

A simple Arduino Uno Clock without RTC module for beginners.

Piezo Tunes
Easy
  • 360
  • 5

Full instructions

In this project, you're going to learn how you can play your own melody with a Piezo speaker, using code generated by Circuito.io

ProjectsCommunitiesContestsLiveJobsFree StoreBlogAdd projectSign up / Login
Respect project