Arduino reads input voltage&arduino simulator
// Pin 13 has an LED connected on most Arduino boards. // give it a name: int led = A0; // the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. Serial.begin(9600);// Open the serial port and set the baud rate to 9600 pinMode(led, OUTPUT); digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) } // the loop routine runs over and over again forever: void loop() { int sensorValue = analogRead(led); //Convert the analog signal to a voltage of 0-5V float voltage = sensorValue * (5.0 / 1023.0); //Print digital signal Serial.println(sensorValue); //Print voltage Serial.println(voltage); delay(2000); }