Cookie Vending Machine
Cookie Vending Machine
3rd Semester
Self-Study Report
Title:
Cookie vending Machine
USN: 1RV20EC133
Cookie Vending Machine
Introduction:
In this project we will be looking at the design and working of a cookie
vending machine which is a device which gives a specified output
based on unique inputs. This input dependent logic is coded using an
Arduino Uno.
Components used:
To build our setup, we used the following components which are
easily available in stores:
DC Motor
Arduino Uno
Wires
LED
Keypad
We also used the following software to build a simulation:
• TinkerCad software
• Arduino IDE software
Software used:
Arduino IDE: The Arduino Integrated Development Environment - or Arduino Software
(IDE) - contains a text editor for writing code, a message area, a text console, a toolbar with
buttons for common functions and a series of menus. It connects to the Arduino and
Genuine hardware to upload programs and communicate with them.
Code:
#include <Keypad.h>
#define codeLength 4
char code[codeLength];
byte keycount = 0;
char codeMotor1[codeLength]="11A";
char
codeMotor2[codeLength]="12A";
char codeMotor3[codeLength]="13A";
char
codeMotor4[codeLength]="14A";
char hexaKeys[ROWS]
[COLS] = {
};
void setup()
Serial.begin(9600);
pinMode(13, OUTPUT);
pinMode(12,
OUTPUT);
pinMode(11, OUTPUT);
pinMode(10,
OUTPUT);
void loop()
if(customKey){
//Serial.println(customKey);
code[keycount]=customKey;
Serial.println(code);
keycount++;
if (customKey == 'C')
{ deleteCount();
Serial.println("Code cleared!");
}
if(keycount==codeLength-1){
//Serial.println(code);
if(!strcmp(code, codeMotor1))
{ Serial.println("Motor 1
delay(3000);
digitalWrite(13, LOW);
delay(500);
{ Serial.println("Motor 2
delay(3000);
digitalWrite(12, LOW);
delay(500);
} else if(!strcmp(code,
codeMotor3)){
Serial.println("Motor 3 activated!");
digitalWrite(11, HIGH);
delay(3000);
digitalWrite(11, LOW);
delay(500);
{ Serial.println("Motor 4
delay(3000);
digitalWrite(10, LOW);
delay(500);
} else {
Serial.println("Incorrect
code!");
delay(500);
deleteCount();
void deleteCount()
{ while(keycount !
=0){
code[keycount--]=0;
return;
Working:
We use the code given above to design matrices in order to define
the variables and operate the vending machine. The buttons on the
vending machine are linked to the arduino uno which then gives the
processed output to the servo motors. The basic logic we use is to
check if a particular code is typed and once the logic for confirmation
becomes one we activate the particular motor to drop the required
cookie.
When we give input as 12A.Above is the output