Permalink
Browse files

fixed read command to end in '\r' instead of '\n'

removed some debugging junk as well.
  • Loading branch information...
1 parent bfc77ed commit dc291713d0cf20b55690c9b966354f01f2442138 @snatchev committed Dec 7, 2012
Showing with 5 additions and 7 deletions.
  1. +5 −7 Omega_PHH37.cpp
View
@@ -21,19 +21,18 @@ Omega_PHH37::Omega_PHH37()
void Omega_PHH37::begin()
{
Serial.begin(9600, SERIAL_8E2);
- //Serial.print("Omega PHH37");
}
bool Omega_PHH37::read()
{
- char *p = &_input[0];
memset(_input, '\0', 64);
- Serial.write("#001N\n");
- Serial.flush();
+ Serial.write("#001N\r\n");
- while(Serial.available() > 0 && p != 0) {
- *p++ = Serial.read();
+ delay(1);
+
+ if(Serial.available()) {
+ Serial.readBytes(_input, 21);
}
strncpy(_range_code, _input+5, 2);
@@ -113,7 +112,6 @@ int Omega_PHH37::displayMode()
bool Omega_PHH37::validInput()
{
- //Serial.println(_input);
if(strlen(_input) != 21)
return false;

0 comments on commit dc29171

Please sign in to comment.