How to write Lm35 temperture sensor code in Processing .

edited August 2017 in Arduino

Im using this code in Arduino Uno

int val; // variable to store analog value

int tempPin = A0; // giving name to temp pin

float temperature;

void setup()

{

Serial.begin(9600); // start serial at 9600 baud rate

}

void loop()

{

val = analogRead(tempPin);

temperature = (val * 4.88)/10;

Serial.println(temperature);

delay(1000); // delay of 1s so that the serial doesn’t runs mad

}

As i am new to Processing i have trouble writing the code. I have also add G4P to build GUI but how to do i get the readings from Arduino to Processing.


Answers

  • Edit your post (gear icon in the top right corner of your post), select your code and hit ctrl+o to format it. Make sure there is an empty line above and below your code.

    Building the GUI using G4P is one task. I suggest you get a code working only interacting with your arduino first. After data exchange btw arduino and Processing is working, you can jump to the next challenge.

    When you format your code, you can also add your ino code. Also check this post:

    https://forum.processing.org/two/discussion/comment/102828/#Comment_102828

    Kf

Sign In or Register to comment.