Go Down

Topic: Help with Communicating with AppleScript (ASproxy) (Read 532 times) previous topic - next topic

samg1988

Hello. I've been trying to get ASproxy to work in conjunction with my ardiuno.

I have ASproxy which will read the serial, and if a '1' comes up, it should execute a python script I have that deletes the emails in my Gmail account.

The problem I'm having is that while the arduino program is open, ASproxy cannot communicate with the serial because arduino is accessing the serial. Its the same the other way round. I need the program to be running for my code to work.

Can anyone help me?
My code on the arduino if it helps is:
(The code puts on an LED if I have emails, and prints a '1' when I press a button on the arduino)

Code: [Select]
// led wired + to pin 12, resistor to positive +5v

int outPin = 12; // Output connected to digital pin 12
int mail = LOW; // Is there new mail?
int val; // Value read from the serial port
int inPin = 6;   // choose the input pin (for a pushbutton)
int val2 = 0;     // variable for reading the pin status



void setup()
{
pinMode(outPin, OUTPUT); // sets the digital pin as output
Serial.begin(9600);
Serial.flush();
//mail = HIGH; // start off with lights out
pinMode(inPin, INPUT);    // declare pushbutton as input
}

void loop()
{
 
 
 //if (val2 == HIGH)
 //if (val == 1)
 
 
 
// Read from serial port
if (Serial.available())
{
  val = Serial.read();
  Serial.println(val, BYTE);

  if (val == 110) // n = 110 in dec
  {
    mail = LOW;  // HIGH is off because led is connected to +5v on the other side
  }

  else if (val == 109) //109 = m in dec
  {
    mail = HIGH; // LOW is on because led is connected to +5v on the other side
  }
 
 val2 = digitalRead(inPin);  // read input value
 Serial.println(digitalRead(val2));
 val = Serial.read();
 
 

}

// Set the status of the output pin
digitalWrite(outPin, mail);


}

melka

You can't have 2 softwares that communicates on the same serial port. Why do you need the arduino IDE when ASProxy is running ?

samg1988

my arduino board doesnt run unless IDE is running. I would have thought as long as its connected to my mac it would run in the background... but for some reason it doesnt. It stops communicating as soon as the arduino program is closed.

melka

The board is still runing, but you don't see it because there's no program to receive it.
As soon as you open another serial terminal (hyperterm, custom processing sketch, ...) it will send data.

Go Up