Hi, when I'm running the code below, I want to pick up the output in Processing. I can't get past the Serial Port busy error on my mac, though it seems to work on my Windows laptop. I have the correct port selected in both programs.
If I run processing before I plug in the Arduino, then Processing loads fine, but the Arduino won't connect to the port.
What do I have to do?
Thanks.
#include "DHT.h"
#define DHTPIN 2 // what pin we're connected to
#define DHTTYPE DHT22 // DHT 22 (AM2302)
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600);
dht.begin();
}
void loop() {
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
float h = dht.readHumidity();
float t = dht.readTemperature();
int l = analogRead(A3);
// check if returns are valid, if they are NaN (not a number) then something went wrong!
if (isnan(t) || isnan(h)) {
Serial.println("Failed to read from DHT");
} else {
Serial.print(h);
Serial.print(",");
Serial.print(t);
Serial.print(",");
Serial.println(l);
delay(2000);
}
}