Initial temp sensor test

So the latest sensor I got hold of for the arduino (compatible with Sparki) is a temperature sensor. This model is using the LM35 temperature sensor which is one of the most common temperature sensors.

DSC_5991

So the first thing was to test the code with Sparki. To do this, I just simply tweaked the example code found at arduino playground, to suit Sparki. Here’s what I ended up with:

#include <Sparki.h> // include the sparki library
float tempC;
int reading;
int tempPin = 8;

void setup()
{
analogReference(INTERNAL);
}

void loop()
{
reading = analogRead(tempPin);
tempC = reading / 9.31-10;
sparki.clearLCD();
sparki.print(tempC);
sparki.updateLCD();
delay(1000);
}

It’s basically a direct copy. But now I can move on and actually use this info…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s