0% found this document useful (0 votes)
24 views

Float Int Int: Printvoltage Inputsignal 0 Float Temperature 0

This code declares variables for an instrumentation circuit including a float to store voltage readings, an integer for the input signal, and a float for temperature. It sets up analog input on pin A0 and the serial port at 9600 baud. The main loop reads the analog pin, prints the digital value, calculates and prints the voltage, calculates and prints the temperature in Celsius, with a 1 second delay between each reading.

Uploaded by

Ntony Galland
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Float Int Int: Printvoltage Inputsignal 0 Float Temperature 0

This code declares variables for an instrumentation circuit including a float to store voltage readings, an integer for the input signal, and a float for temperature. It sets up analog input on pin A0 and the serial port at 9600 baud. The main loop reads the analog pin, prints the digital value, calculates and prints the voltage, calculates and prints the temperature in Celsius, with a 1 second delay between each reading.

Uploaded by

Ntony Galland
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

//------------------------------------------------------------------------------------------------------------------------

----- 
//DT021A/3 Instrumentation   Written by Moya Clarke 15.10.2019 
//Declaring the variables for the code 
//------------------------------------------------------------------------------------------------------------------------
----- 
 float printVoltage=0; 
 int inputsignal=0; 
 float temperature=0; 
 int Vin = A0;  
  
 void setup(){ 
   Serial.begin(9600);    
pinMode (A0,INPUT);   

  
 void loop(){ 
   inputsignal=analogRead(Vin);  
   Serial.print("Digital value being read into the circuit:
"); 
   Serial.println(inputsignal);  
   delay(1000);  
  
 //converting the digital bit value back to voltage  
 printVoltage = (analogRead(Vin)/1023.0)*5.0;   
 Serial.print("Voltage into circuit: "); 
 Serial.println(printVoltage);  
 delay(1000);  
  
 //Converting digital value to temperature in Celsius 
 temperature=(printVoltage*16);  
Serial.print("Temperature Value: ");  
 Serial.println(temperature);  
 delay(1000);  
 } 

You might also like