0% found this document useful (0 votes)
30 views6 pages

Template For Activity 6 (Joystik Shield)

The document outlines a project-based learning activity at K J Somaiya College of Engineering involving the use of a Joystick Shield and DC Motor control with Arduino. It includes tasks for testing joystick buttons and controlling motor speed and direction, along with evaluation criteria and team contributions. The project emphasizes hands-on experience in Arduino programming, circuit connections, and problem-solving skills.

Uploaded by

dannybhagat2006
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views6 pages

Template For Activity 6 (Joystik Shield)

The document outlines a project-based learning activity at K J Somaiya College of Engineering involving the use of a Joystick Shield and DC Motor control with Arduino. It includes tasks for testing joystick buttons and controlling motor speed and direction, along with evaluation criteria and team contributions. The project emphasizes hands-on experience in Arduino programming, circuit connections, and problem-solving skills.

Uploaded by

dannybhagat2006
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

K J Somaiya College of Engineering

A Constituent College of Somaiya Vidyavihar University


Course: Introduction to Project Based Learning

Template for Arduino and Joystick Shield and Motor Activity


Statement Given:
Task A:
Using Joystick Shield
a) Test Up , Down , Left , Right Buttons with LED output
b) Test 2-Axis joystick values with Intensity of LED
Task B:
a) Try Running DC Motor in Forward and Reverse Direction and
Control Speed of DC Motor using TinkerCAD

Evaluation Criteria:
1. Connections as per task given,
2. Code for Arduino for the Task.
3. Successful execution of the activities.

Performance-15 Marks : Joystick tasks with LEDs = 10 marks , DC Motor using


TinkerCAD = 5 marks
Submission-10 Marks

Team

Sr No Roll No Name Work Done

1 16014024001 Vansh Anand Designing + Connections

2 16014024002 Angel Mariam Shibu Photos + Connections

3 16014024003 Pranav Bagrecha Photos + Connections

4 16014024004 Manthan Belekar Photos + Connections

5 16014024005 Rohaan Bhagat Connections + Writeup

Fill your details as per following points


K J Somaiya College of Engineering
A Constituent College of Somaiya Vidyavihar University
Course: Introduction to Project Based Learning

● Code for the task given

Using Joystick Shield

Task 1: Test Up , Down , Left , Right Buttons with LED output

#include <nRF24L01.h>
#include <RF24.h>
#include <SPI.h>

#define CE_PIN 9
#define CSN_PIN 10

int up_button = 2; // Boton Amarillo - A


int down_button = 4; // Boton Amarillo - C
int left_button = 5; // Boton Azul - D
int right_button = 3; // Boton Azul - B
int start_button = 6; // Boton F
int select_button = 7; // Boton E
int analog_button = 8; //
int x_axis = A0;
int y_axis = A1;
int buttons[]={up_button, down_button,left_button,
right_button,start_button,select_button,analog_button};
const uint64_t pipe = 0xE8E8F0F0E1LL;
RF24 radio(CE_PIN,CSN_PIN);
char msg[20] = "";

void setup(){
for(int i; i <7 ; i++)
{
pinMode(buttons[i],INPUT);
digitalWrite(buttons[i],HIGH);
}
Serial.begin(9600);
radio.begin();
radio.openWritingPipe(pipe);
}

void loop(){

if(digitalRead(up_button)==LOW)
{
char msg[]="up";
radio.write(&msg,sizeof(msg));
delay(100);
Serial.println("UP Button Pressed");
}
K J Somaiya College of Engineering
A Constituent College of Somaiya Vidyavihar University
Course: Introduction to Project Based Learning

if(digitalRead(down_button)==LOW)
{
char msg[]="down";
radio.write(&msg,sizeof(msg));
delay(100);
Serial.println("Down Button Pressed");
}
if(digitalRead(left_button)==LOW)
{
char msg[]="left";
radio.write(&msg,sizeof(msg));
delay(100);
Serial.println("Left Button Pressed");
}
if(digitalRead(right_button)==LOW)
{
char msg[]="right";
radio.write(&msg,sizeof(msg));
delay(100);
Serial.println("Right Button Pressed");
}
Serial.print("\n X = "),Serial.print(analogRead(x_axis)),Serial.print(" \n Y = "),
Serial.print(analogRead(y_axis));
Serial.print(" ");
delay(1000);
}

Task 2: Test 2-Axis joystick values with Intensity of LED

#include <nRF24L01.h>
#include <RF24.h>
#include <SPI.h>

#define CE_PIN 9
#define CSN_PIN 10

int up_button = 2; // Boton Amarillo - A


int down_button = 4; // Boton Amarillo - C
int left_button = 5; // Boton Azul - D
int right_button = 3; // Boton Azul - B
int start_button = 6; // Boton F
int select_button = 7; // Boton E
int analog_button = 8; //
int x_axis = A0;
int y_axis = A1;
K J Somaiya College of Engineering
A Constituent College of Somaiya Vidyavihar University
Course: Introduction to Project Based Learning

int buttons[]={up_button, down_button,left_button,


right_button,start_button,select_button,analog_button};
const uint64_t pipe = 0xE8E8F0F0E1LL;
RF24 radio(CE_PIN,CSN_PIN);
char msg[20] = "";

void setup(){
for(int i; i <7 ; i++)
{
pinMode(buttons[i],INPUT);
digitalWrite(buttons[i],HIGH);
}
Serial.begin(9600);
radio.begin();
radio.openWritingPipe(pipe);
}

void loop(){

if(digitalRead(up_button)==LOW)
{
char msg[]="up";
radio.write(&msg,sizeof(msg));
delay(100);
Serial.println("UP Button Pressed");
}

if(digitalRead(down_button)==LOW)
{
char msg[]="down";
radio.write(&msg,sizeof(msg));
delay(100);
Serial.println("Down Button Pressed");
}
if(digitalRead(left_button)==LOW)
{
char msg[]="left";
radio.write(&msg,sizeof(msg));
delay(100);
Serial.println("Left Button Pressed");
}
if(digitalRead(right_button)==LOW)
{
K J Somaiya College of Engineering
A Constituent College of Somaiya Vidyavihar University
Course: Introduction to Project Based Learning

char msg[]="right";
radio.write(&msg,sizeof(msg));
delay(100);
Serial.println("Right Button Pressed");
}
Serial.print("\n X = "),Serial.print(analogRead(x_axis)),Serial.print(" \n Y = "),
Serial.print(analogRead(y_axis));
Serial.print(" ");
delay(1000);
}

Task 3 : Controlling DC Motor Speed and Direction Control

void setup()
{
pinMode(11, OUTPUT);// En of Motor 1
pinMode(7,OUTPUT); // In1 of Motor 1
pinMode(6,OUTPUT);// In 2 of Motor 1
}
void fwdrev() // function reverses direction of motor
{
digitalWrite(7,LOW);// In1 = 0, FWD
digitalWrite(6,HIGH);//In2 =1
digitalWrite(11,HIGH);

delay(5000); // Wait for 5 second(s)


digitalWrite(7, LOW);// In1 = 0, Stop
digitalWrite(6,LOW);// In2 = 0

delay(5000); // Wait for 1000 millisecond(s)


digitalWrite(7, HIGH);//In1 =1, REV
digitalWrite(6,LOW);//In2 =0
delay(5000);
digitalWrite(7, LOW);// In1 = 0, Stop
digitalWrite(6,LOW);// In2 = 0
}
void speed () // function for 2 speed settings of DC Motor
{
digitalWrite(7, LOW);
digitalWrite(6,HIGH);
analogWrite(11,50); // Slow Speed
delay(25000); // Wait for 1000 millisecond(s)
K J Somaiya College of Engineering
A Constituent College of Somaiya Vidyavihar University
Course: Introduction to Project Based Learning

analogWrite(11,200);// High Speed


digitalWrite(7, LOW);
digitalWrite(6,HIGH);
delay(25000); // Wait for 1000 millisecond(s)
}

void loop()
{
fwdrev();
speed();

● Photo and Video of Actual implementation

https://drive.google.com/drive/folders/1sSuwztYuAyTUMetF6xK-EjHFtSvvhKvx?
usp=sharing

● Observations , reflection on activity


In this activity, we successfully tested the joystick shield with an Arduino and
controlled a DC motor using TinkerCAD. We verified the joystick buttons by
controlling LED outputs and adjusted LED intensity based on the joystick's 2-axis
values. Additionally, we controlled the DC motor’s direction and speed using PWM.
This hands-on experience helped us understand Arduino programming, circuit
connections, and motor control while improving our problem-solving skills.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy