Pharmaceutical Vending Machine

It dispenses out the medicine required whenever a person pushes a button on the app and payment is done through the user's digital wallet.

BeginnerShowcase (no instructions)24 hours1,309
Pharmaceutical Vending Machine

Things used in this project

Story

Read more

Code

makeathon.ino

Arduino
dispensing the medicine from vending machine
char m; //Declare a variable to store signal
void setup() 
{
  // put your setup code here, to run once:
  Serial.begin(9600); //To access data exchange via bluetooth
  pinMode(9,OUTPUT); //Control left motor 
  pinMode(10,OUTPUT); //Control left motor
  pinMode(11,OUTPUT); //Control right motor
  pinMode(12,OUTPUT); //Control right motor
  
  //Initially both the motors are in stop position
  digitalWrite(10,LOW);
  digitalWrite(9,LOW);
  digitalWrite(11,LOW);
  digitalWrite(12,LOW);
  delay(2000);
}

void loop() 
{
   // Put your main code here, to run repeatedly:
   // while(!Serial.available())
   if(Serial.available()>0) //When signal begins
     {
       m=Serial.read(); //Read the signal
       if(m=='a') 
       {
          left(); //Jumps to the function 'left'
       }
    
       if(m=='b')
       {
          right(); //Jumps to the function 'right'
       }
       delay(200);
     }
}


void left()
{
      //Function left starts
      digitalWrite(9,LOW); //Left motor starts moving
      digitalWrite(10,HIGH); //Left motor starts moving
      digitalWrite(11,LOW); //Right motor is stationary
      digitalWrite(12,LOW); //Right motor is stationary
      delay(1250); //Duration of movement of left motor
      
      //Both the motors Come to stationary position
      digitalWrite(10,LOW);
      digitalWrite(9,LOW);
      digitalWrite(11,LOW);
      digitalWrite(12,LOW);
      delay(1000);
}

void right()
{
      digitalWrite(11,LOW); //Right motor starts moving
      digitalWrite(12,HIGH); //Right motor starts moving
      digitalWrite(10,LOW); //Left motor is stationary
      digitalWrite(9,LOW); //Left motor is stationary
      delay(650);

      //Both the motors Come to stationary position
      digitalWrite(10,LOW);
      digitalWrite(9,LOW);
      digitalWrite(11,LOW);
      digitalWrite(12,LOW);
      delay(1000);     
}

Credits

Shivam Gupta

Shivam Gupta

10 projects • 6 followers
hmsgupta.3062@gmail.com
Dr. Umesh Dutta

Dr. Umesh Dutta

38 projects • 53 followers
Working as Director of Innovation Centre at Manav Rachna, India. I am into development for the last 12 years.
Energia

Energia

34 projects • 26 followers
Founder of @energiaproject
Texas Instruments University Program

Texas Instruments University Program

91 projects • 119 followers
TI helps students discover what's possible to engineer their future.
Akanksha Prakash

Akanksha Prakash

0 projects • 1 follower

Comments