/*############################################################################## Author: * Mirko Prosseda (06-2013) * email: mirko.prosseda@gmail.com Description: * ±5A Linear Current Sensor test sketch v1.0 * Read current value from the sensor and print its value on the Serial Monitor Connections: * BOARD -> ARDUINO * Vcc -> 5V * GND -> GND * OUT -> PIN A0 ##############################################################################*/ // Define constants and variables const int analogInPin = A0; // Analog input pin that the current sensor is attached to int sensorValue = 0; // value read from the sensor float outputValue = 0; // converted value of the sensor reading // Initialization void setup() { Serial.begin(9600); // Serial Port initialization } // main loop void loop() { sensorValue = analogRead(analogInPin); // reads the sensor value outputValue = ((float)(sensorValue - 512) * 5 / 0.185) / 1024; // convert it Serial.print("Current Sensor value= " ); // print results Serial.print(outputValue); Serial.println("A"); delay(200); }