Serial.available is never > 0
in
Integration and Hardware
•
1 year ago
I am writing a sketch to process the serial data from a DMM
( http://www.multimeterwarehouse.com/TP4000ZC/TP4000ZC_serial_protocol.pdf )
myPort.available() is never greater than 0.
opening the serial port in a serial terminal shows the data from the DMM
coming into the port.
Also , if I send the packet from my arduino the processing code works fine.
Why isn't the data coming into the port from the DMM when
switching the port number to the arduino brings the data in fine?
Processing code ---> from the example
// Example by Tom Igoe
import processing.serial.*;
// The serial port:
Serial myPort;
void setup() {
// List all the available serial ports:
println(Serial.list());
/* I know that the first port in the serial list on my mac
is always my Keyspan adaptor, so I open Serial.list()[0].
Open whatever port is the one you're using.
*/
// myPort = new Serial(this, Serial.list()[0], 9600);
myPort = new Serial(this, Serial.list()[0], 2400, 'N', 8, 1.0);
}
void draw() {
while (myPort.available() > 0) {
int inByte = myPort.read();
println(inByte);
}
}
Arduino code
uint8_t cmd2[]={0x13,0x27,0x3f,0x47,0x5f,0x67,0x7f,0x87,0x9f,0xA0,0xB0,0xC0,0xD0,0xE4}; // all 8s
Serial.write(cmd2,14);
1