Following instructions as listed in the documentation Serial (RS-232 / RS-422 serial protocol
I’m unable to successfully connect to the device (Arduino Uno) using
DeviceOpen["Serial",{"COM10","BaudRate"->9600}]
(*SerialLink`SerialPortOpen::nopen: Could not open the port COM10.*)
Port COM10 is alive, well and tested in the computer, using another program to link the device, send byte codes and receive values back.
What is the set up in your Arduino? Can you show the sketch? Have you see the serial monitor ? I had similar problems. It looks like the Matematica kernel gets hang. Close the notepad or quick and restart kernel.
Also, you are using he putty client to capture the Port 10, therefore, Mathematica will not be able to capture it the same time.
Indeed I closed the Serial Monitor and Putty. Only one program can communicate with the arduino at a time. The reason Im showing it on the screen is that indeed the COM10 port works with all tools except mathematica.
Here is the sketch
#include <dht11.h>
dht11 DHT11;
#define DHT11PIN 2
int inByte = 0; // incoming serial byte
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
if (Serial.available() > 0) {
// get incoming byte:
inByte = Serial.read();
if (inByte == 84){
int chk = DHT11.read(DHT11PIN);
Serial.println((float)DHT11.temperature, DEC);
}
if (inByte == 72){
int chk = DHT11.read(DHT11PIN);
Serial.println((float)DHT11.humidity, DEC);
}
}
}
Diego… My apologies for bringing an out of subject issue. I have been going back and forth between Arduino and Mathematica Devices forums. At some point the line got blurred. Thank you for the links.