Go Down

Topic: Resource Busy on Mac (Read 2980 times) previous topic - next topic

petterssonerik

Feb 22, 2016, 10:01 pm Last Edit: Feb 22, 2016, 10:17 pm by petterssonerik
Hello,

I'm new to all this and I'm working my way though the exercises in the starter kit. I stumbled upon this error in the beginning but then it disappeared for a while, now I'm on exercise nr 3.

All I can find by googling is "Wait for the transmission of outgoing data to complete". Well it certanly doesn't work for me. Some people suggested switching USB-port in "tools->ports" but I only have this one, WiFi and bluetooth available according to the drop down menu.

The error:
avrdude: ser_open(): can't open device "/dev/cu.usbmodem1411": Resource busy
ioctl("TIOCMGET"): Inappropriate ioctl for device

It's like it's "stuck" on some old code or something?


Code: [Select]
// named constant for the pin the sensor is connected to
const int sensorPin = A0;
// room temperature in Celcius
const float baselineTemp = 20.0;

void setup() {
  // open a serial connection to display values
  Serial.begin(9600);
  // set the LED pins as outputs
  // the for() loop saves some extra coding
  for (int pinNumber = 2; pinNumber < 5; pinNumber++) {
    pinMode(pinNumber, OUTPUT);
    digitalWrite(pinNumber, LOW);
  }
}

void loop() {
  // read the value on AnalogIn pin 0
  // and store it in a variable
  int sensorVal = analogRead(sensorPin);

  // send the 10-bit sensor value out the serial port
  Serial.print("sensor Value: ");
  Serial.print(sensorVal);

  // convert the ADC reading to voltage
  float voltage = (sensorVal / 1024.0) * 5.0;

  // Send the voltage level out the Serial port
  Serial.print(", Volts: ");
  Serial.print(voltage);

  // convert the voltage to temperature in degrees C
  // the sensor changes 10 mV per degree
  // the datasheet says there's a 500 mV offset
  // ((volatge - 500mV) times 100)
  Serial.print(", degrees C: ");
  float temperature = (voltage - .5) * 100;
  Serial.println(temperature);

  // if the current temperature is lower than the baseline
  // turn off all LEDs
  if (temperature < baselineTemp + 2) {
    digitalWrite(2, LOW);
    digitalWrite(3, LOW);
    digitalWrite(4, LOW);
  } // if the temperature rises 2-4 degrees, turn an LED on
  else if (temperature >= baselineTemp + 2 && temperature < baselineTemp + 4) {
    digitalWrite(2, HIGH);
    digitalWrite(3, LOW);
    digitalWrite(4, LOW);
  } // if the temperature rises 4-6 degrees, turn a second LED on
  else if (temperature >= baselineTemp + 4 && temperature < baselineTemp + 6) {
    digitalWrite(2, HIGH);
    digitalWrite(3, HIGH);
    digitalWrite(4, LOW);
  } // if the temperature rises more than 6 degrees, turn all LEDs on
  else if (temperature >= baselineTemp + 6) {
    digitalWrite(2, HIGH);
    digitalWrite(3, HIGH);
    digitalWrite(4, HIGH);
  }
  delay(1);
}



Thanks for all the help.

codlink

Do a search with the error message.  Lots of threads on the same error.
//LiNK

petterssonerik

Hey, thanks for the tip but as I said nothing I found helped.

Although, I managed to find the problem eventually. It turns out that a program which connects my computer to my training watch was on and occupying the port. It starts automatically when i start my computer, therefore restarting didn't help. I used "lsof | grep <portnumber>" in my terminal to see which program was occupying the port.

dvcpro50

Did you ever resolve your error I am encountering this myself I am using a Mac to upload the IDE

this is what I get

avrdude: ser_open(): can't open device "/dev/cu.usbmodem1411": Resource busy

I find that if I keep pressing the upload button at some point it will upload.  Its as if the board is in the middle of a process and won't release long enough to allow my code to be uploaded.

CrossRoads

Try pressing &  holding Reset, when the IDE shows "compiled xxx ox 32xxx bytes" then release reset.

Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

dvcpro50

well I also found on my Mac that My Movescount Application which loads when I boot my Mac was using the same Port and was causing the Board to prevent me from loading the sketch. 

Thanks to the user above my post for his comments it helped me sort this out.


Go Up