RamiChan

Untitled

Apr 26th, 2016
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. [code]
  2. //declare variables
  3. float tempC;
  4. int tempPin = 0;
  5.  
  6. void setup()
  7. {
  8. Serial.begin(9600); //opens serial port, sets data rate to 9600 bps
  9. }
  10.  
  11. void loop()
  12. {
  13. tempC = analogRead(tempPin); //read the value from the sensor
  14. tempC = (5.0 * tempC * 100.0)/1024.0; //convert the analog data to temperature
  15. Serial.print((byte)tempC); //send the data to the computer
  16. delay(1000); //wait one second before sending new data
  17. }
  18. [/code]
Advertisement
Add Comment
Please, Sign In to add comment