Robotic Bartender

Hi all,
I am sort of new to the Arduino world, my only other project to date is a hidden bookshelf door where with the pull of a book the Arduino fires a linear actuator for a certain time then delays and reverses...so not much coding.

I am starting now to work on my "Robotic Bartender". Basically I am looking to send a simple code from an app to the Arduino to then fire a sequence of motors depending on the code received but I cannot get the app to connect to the board to fire the sequence. I can get the sequence to go in a basic loop so I know the wiring is correct it's just something with the communication.

Below is the code I have so far as the test run and will build from there once I figure out the connection problem.

int input = 0;

// These constants won't change:
const int RUM = 13; //
const int COKE = 12; //
const int DIETCOKE = 12;

void setup() {
Serial.begin(9600);
pinMode(RUM, OUTPUT);
pinMode(COKE, OUTPUT);
pinMode(DIETCOKE, OUTPUT);
}

void loop() {
//check if there's incoming data,
if(Serial.available() > 0){
//if so, then read the incoming data.
input = Serial.read();

//make different colours depending on the input value
if(input == '1'){
digitalWrite(RUM, HIGH);
delay(2000);
digitalWrite(COKE, HIGH);
delay(5000);
digitalWrite(RUM, LOW);
digitalWrite(COKE, LOW);
}
else if(input == '2' ){
digitalWrite(RUM, HIGH);
delay(2000);
digitalWrite(DIETCOKE, HIGH);
delay(5000);
digitalWrite(RUM, LOW);
digitalWrite(DIETCOKE, LOW);
}
}
}

What kind of app do you want to connect to the Arduino, and how? If your code works with the Serial Monitor, you have to make the app connect to the Arduino COM port.

Check this project out:

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Do you realize you have Coke and Diet Coke as the same output pin number?

Thanks.. Tom.. :slight_smile:

DrDiettrich:
What kind of app do you want to connect to the Arduino, and how? If your code works with the Serial Monitor, you have to make the app connect to the Arduino COM port.

I was trying with both the MIT app inventor and thunkduino. I guess I am having trouble with getting apps to send via com port.

Opps added the diet coke at the last second to show a second option and didn't see I put the wrong pin, updated code below

int input = 0;

// These constants won't change:
const int RUM = 13;    // 
const int COKE = 12;       // 
const int DIETCOKE = 11;
 

void setup() {
 Serial.begin(9600);
  pinMode(RUM, OUTPUT);
  pinMode(COKE, OUTPUT);
  pinMode(DIETCOKE, OUTPUT);
}
 

void loop() {
  //check if there's incoming data,  
if(Serial.available() > 0){    
    //if so, then read the incoming data.    
    input = Serial.read();        

    //make different colours depending on the input value    
    if(input == '1'){      
digitalWrite(RUM, HIGH);
  delay(2000);
  digitalWrite(COKE, HIGH);
  delay(5000);
digitalWrite(RUM, LOW);
digitalWrite(COKE, LOW);    
    }    
    else if(input == '2' ){      
  digitalWrite(RUM, HIGH);
  delay(2000);
  digitalWrite(DIETCOKE, HIGH);
  delay(5000);
digitalWrite(RUM, LOW);
digitalWrite(DIETCOKE, LOW);
}
}
}

Hi,
What Bluetooth device are you using, do you get it to pair with your phone?

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom.. :slight_smile:

TomGeorge:
Hi,
What Bluetooth device are you using, do you get it to pair with your phone?

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom.. :slight_smile:

I'm not using Bluetooth, just using usb connection

Hi,
As asked earlier, does it work using the Arduino IDE monitor?

Can your phone/tablet see the com port?
Does the phone/tablet recognise that something has been plugged in when you physically connect to it?
What model Arduino?

Thanks.. Tom.. :slight_smile:

TomGeorge:
Hi,
As asked earlier, does it work using the Arduino IDE monitor?

Can your phone/tablet see the com port?
Does the phone/tablet recognise that something has been plugged in when you physically connect to it?
What model Arduino?

Thanks.. Tom.. :slight_smile:

Not sure what you mean by working on the IDE monitor.
My phone recognizes something is there but that's about it.
The most connection i got was with the windows remote arduino experience app on my tablet but all i was able to do was turn on and off individual pins.
I'm working with an Arduino uno.

jdilucente:
Not sure what you mean by working on the IDE monitor.

The IDE you program the UNO with has a "Monitor" facility that connects to the com port you programmed through and will let you send and receive data on the comm port.

Select "TOOLS" then "SerialMonitor"

When its window opens, select the baud rate that you have Serial.begin set at in your program,
You can then send your 1 or 2 commands in the top send window.

It is invaluable for debugging as Serial.print statements in the code, send data to the receive window of the IDE.
https://learn.adafruit.com/adafruit-arduino-lesson-5-the-serial-monitor?view=all

Tom.. :slight_smile: