Go Down

Topic: attopilot Voltage/Current Sensor - Blows virtual Comm port out (Read 709 times) previous topic - next topic

CyberXena

I'm testing the Attopilot 90 amp sensor and when i turn off the power source the virtual comm port
is gone the error is comport in use by other user. Anyone seen this behaviour before?
USB connected UNO with test code from Sparkfun edited by me.
Code: [Select]
int VRaw; //This will store our raw ADC data
float VFinal; //This will store the converted data

float Factor = 13.9;
void setup()
{
  Serial.begin(9600);
}
void loop() { 
   if (Serial.available() > 0)
   {
    int cmd = Serial.read();
     //Measurement
     switch(cmd)
     {
        //Conversion
        case 'a':
        VRaw = analogRead(A0);
        delay(200);
        VFinal = VRaw/Factor; //90 Amp board
        Serial.print(VFinal);
        Serial.println("   Volts-1");
        break;
        case 'b':
        VRaw = analogRead(A1);
        delay(200);
        VFinal = VRaw/Factor; //90 Amp board 
        Serial.print(VFinal);
        Serial.println("   Volts-2");
        break;
     }
   }
}

Go Up