How do I send sensor data to a nokia 5110 lcd?

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
pnguin9999
 
Posts: 8
Joined: Tue Jun 11, 2013 4:53 am

How do I send sensor data to a nokia 5110 lcd?

Post by pnguin9999 »

Please help. I am using the temperature sketch circ-10 that came in the experimentation kit from Adafruit, and would like to export the sensor data to the nokia 5110 screen. I have tried using the Adafruit PCD8544, and GFX libraries as well as the Philips 8544 and LCD5110. LCD is wired correctly PCD test sketch works fine. The following code is as close a I have been able to come to getting code based on the Adafruit library to compile, but still comes up with the following error;

In file included from circ10serialtolcd.ino:1:
C:\Users\jerry\Documents\Arduino\libraries\Adafruit_PCD8544/Adafruit_PCD8544.h:52: error: expected class-name before '{' token


Here is the sketch;

Code: Select all

#include <Adafruit_PCD8544.h>

#include <Adafruit_GFX.h>

/*     ---------------------------------------------------------
 *     |  Arduino Experimentation Kit Example Code             |
 *     |  CIRC-10 .: Temperature :. (TMP36 Temperature Sensor) |
 *     ---------------------------------------------------------
 *   
 *  A simple program to output the current temperature to the IDE's debug window 
 * 
 *  For more details on this circuit: http://tinyurl.com/c89tvd 
 */

//TMP36 Pin Variables
int temperaturePin = 0; //the analog pin the TMP36's Vout (sense) pin is connected to
                        //the resolution is 10 mV / degree centigrade 
                        //(500 mV offset) to make negative temperatures an option

/*
 * setup() - this function runs once when you turn your Arduino on
 * We initialize the serial connection with the computer
 */
void setup()
{
  Serial.begin(9600);  //Start the serial connection with the copmuter
                       //to view the result open the serial monitor 
                       //last button beneath the file bar (looks like a box with an antenae)

 
  LcdInitialise();
  SerialInitialise();
} 
void loop()                     // run over and over again
{
 float temperature = getVoltage(temperaturePin);  //getting the voltage reading from the temperature sensor
 temperature = (temperature - .5) * 100;
 Serial.print(temperature); //converting from 10 mv per degree wit 500 mV offset
                                                  //to degrees ((volatge - 500mV) times 100)
 Serial.println(" degrees centigrade");                     //printing the result
 delay(1000);                                     //waiting a second
}

/*
 * getVoltage() - returns the voltage on the analog input defined by
 * pin
 */
float getVoltage(int pin){
 return (analogRead(pin) * .004882814); //converting from a 0 to 1023 digital range
                                        // to 0 to 5 volts (each 1 reading equals ~ 5 millivolts
}
#define SER_BAUD  9600

#define PIN_SCE   7
#define PIN_RESET 6
#define PIN_DC    5
#define PIN_SDIN  4
#define PIN_SCLK  3

#define LCD_C     LOW
#define LCD_D     HIGH

void LcdClear(void)
{
  for (int index = 0; index < 84 * 48 / 8; index++)
  {
    LcdWrite(LCD_D, 0x00);
  }
}

void LcdInitialise(void)
{
  pinMode(PIN_SCE, OUTPUT);
  pinMode(PIN_RESET, OUTPUT);
  pinMode(PIN_DC, OUTPUT);
  pinMode(PIN_SDIN, OUTPUT);
  pinMode(PIN_SCLK, OUTPUT);
  digitalWrite(PIN_RESET, LOW);
  digitalWrite(PIN_RESET, HIGH);
  LcdWrite(LCD_C, 0x22);
  LcdWrite(LCD_C, 0x0C);
  LcdClear();
}

void LcdWrite(byte dc, byte data)
{
  digitalWrite(PIN_DC, dc);
  digitalWrite(PIN_SCE, LOW);
  shiftOut(PIN_SDIN, PIN_SCLK, MSBFIRST, data);
  digitalWrite(PIN_SCE, HIGH);
}

void SerialInitialise(void) {
  Serial.begin(SER_BAUD);
}

void SerialRead(void) {
  if (Serial.available())
  {
    while (Serial.available())
    {
      LcdWrite(LCD_D, Serial.read());
    }
  }
}

This one will compile but nothing appears on the screen;
/*     ---------------------------------------------------------
 *     |  Arduino Experimentation Kit Example Code             |
 *     |  CIRC-10 .: Temperature :. (TMP36 Temperature Sensor) |
 *     ---------------------------------------------------------
 *   
 *  A simple program to output the current temperature to the IDE's debug window 
 * 
 *  For more details on this circuit: http://tinyurl.com/c89tvd 
 */

//TMP36 Pin Variables
int temperaturePin = 0; //the analog pin the TMP36's Vout (sense) pin is connected to
                        //the resolution is 10 mV / degree centigrade 
                        //(500 mV offset) to make negative temperatures an option

/*
 * setup() - this function runs once when you turn your Arduino on
 * We initialize the serial connection with the computer
 */
void setup()
{
  Serial.begin(9600);  //Start the serial connection with the copmuter
                       //to view the result open the serial monitor 
                       //last button beneath the file bar (looks like a box with an antenae)

 
  LcdInitialise();
  SerialInitialise();
} 
void loop()                     // run over and over again
{
 float temperature = getVoltage(temperaturePin);  //getting the voltage reading from the temperature sensor
 temperature = (temperature - .5) * 100;
 Serial.print(temperature); //converting from 10 mv per degree wit 500 mV offset
                                                  //to degrees ((volatge - 500mV) times 100)
 Serial.println(" degrees centigrade");                     //printing the result
 delay(1000);                                     //waiting a second
}

/*
 * getVoltage() - returns the voltage on the analog input defined by
 * pin
 */
float getVoltage(int pin){
 return (analogRead(pin) * .004882814); //converting from a 0 to 1023 digital range
                                        // to 0 to 5 volts (each 1 reading equals ~ 5 millivolts
}
#define SER_BAUD  9600

#define PIN_SCE   7
#define PIN_RESET 6
#define PIN_DC    5
#define PIN_SDIN  4
#define PIN_SCLK  3

#define LCD_C     LOW
#define LCD_D     HIGH

void LcdClear(void)
{
  for (int index = 0; index < 84 * 48 / 8; index++)
  {
    LcdWrite(LCD_D, 0x00);
  }
}

void LcdInitialise(void)
{
  pinMode(PIN_SCE, OUTPUT);
  pinMode(PIN_RESET, OUTPUT);
  pinMode(PIN_DC, OUTPUT);
  pinMode(PIN_SDIN, OUTPUT);
  pinMode(PIN_SCLK, OUTPUT);
  digitalWrite(PIN_RESET, LOW);
  digitalWrite(PIN_RESET, HIGH);
  LcdWrite(LCD_C, 0x22);
  LcdWrite(LCD_C, 0x0C);
  LcdClear();
}

void LcdWrite(byte dc, byte data)
{
  digitalWrite(PIN_DC, dc);
  digitalWrite(PIN_SCE, LOW);
  shiftOut(PIN_SDIN, PIN_SCLK, MSBFIRST, data);
  digitalWrite(PIN_SCE, HIGH);
}

void SerialInitialise(void) {
  Serial.begin(SER_BAUD);
}

void SerialRead(void) {
  if (Serial.available())
  {
    while (Serial.available())
    {
      LcdWrite(LCD_D, Serial.read());
    }
  }
}
Last edited by adafruit_support_bill on Mon Sep 09, 2013 2:56 pm, edited 1 time in total.
Reason: Please use the 'code' button when submitting code

1chicagodave
 
Posts: 564
Joined: Wed Jun 19, 2013 3:35 am

Re: How do I send sensor data to a nokia 5110 lcd?

Post by 1chicagodave »

Two things.

1) When you post code... Highlight all of your code, then click the "code" button above the text box.
image.jpg
image.jpg (15.62 KiB) Viewed 1377 times


2)
Switch the order of the "includes" in your code.
Like this -

Code: Select all


#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>



pnguin9999
 
Posts: 8
Joined: Tue Jun 11, 2013 4:53 am

Re: How do I send sensor data to a nokia 5110 lcd?

Post by pnguin9999 »

Thanks for the reply, I switched the order of includes and it now compiles and works in the serial monitor but still nothing on the LCD.

Code: Select all

#include <Adafruit_GFX.h>

#include <Adafruit_PCD8544.h>


/* ---------------------------------------------------------
* | Arduino Experimentation Kit Example Code |
* | CIRC-10 .: Temperature :. (TMP36 Temperature Sensor) |
* ---------------------------------------------------------
*
* A simple program to output the current temperature to the IDE's debug window
*
* For more details on this circuit: http://tinyurl.com/c89tvd
*/

//TMP36 Pin Variables
int temperaturePin = 0; //the analog pin the TMP36's Vout (sense) pin is connected to
//the resolution is 10 mV / degree centigrade
//(500 mV offset) to make negative temperatures an option

/*
* setup() - this function runs once when you turn your Arduino on
* We initialize the serial connection with the computer
*/
void setup()
{
Serial.begin(9600); //Start the serial connection with the copmuter
//to view the result open the serial monitor
//last button beneath the file bar (looks like a box with an antenae)


LcdInitialise();
SerialInitialise();
}
void loop() // run over and over again
{
float temperature = getVoltage(temperaturePin); //getting the voltage reading from the temperature sensor
temperature = (temperature - .5) * 100;
Serial.print(temperature); //converting from 10 mv per degree wit 500 mV offset
//to degrees ((volatge - 500mV) times 100)
Serial.println(" degrees centigrade"); //printing the result
delay(1000); //waiting a second
}

/*
* getVoltage() - returns the voltage on the analog input defined by
* pin
*/
float getVoltage(int pin){
return (analogRead(pin) * .004882814); //converting from a 0 to 1023 digital range
// to 0 to 5 volts (each 1 reading equals ~ 5 millivolts
}
#define SER_BAUD 9600

#define PIN_SCE 7
#define PIN_RESET 6
#define PIN_DC 5
#define PIN_SDIN 4
#define PIN_SCLK 3

#define LCD_C LOW
#define LCD_D HIGH

void LcdClear(void)
{
for (int index = 0; index < 84 * 48 / 8; index++)
{
LcdWrite(LCD_D, 0x00);
}
}

void LcdInitialise(void)
{
pinMode(PIN_SCE, OUTPUT);
pinMode(PIN_RESET, OUTPUT);
pinMode(PIN_DC, OUTPUT);
pinMode(PIN_SDIN, OUTPUT);
pinMode(PIN_SCLK, OUTPUT);
digitalWrite(PIN_RESET, LOW);
digitalWrite(PIN_RESET, HIGH);
LcdWrite(LCD_C, 0x22);
LcdWrite(LCD_C, 0x0C);
LcdClear();
}

void LcdWrite(byte dc, byte data)
{
digitalWrite(PIN_DC, dc);
digitalWrite(PIN_SCE, LOW);
shiftOut(PIN_SDIN, PIN_SCLK, MSBFIRST, data);
digitalWrite(PIN_SCE, HIGH);
}

void SerialInitialise(void) {
Serial.begin(SER_BAUD);
}

void SerialRead(void) {
if (Serial.available())
{
while (Serial.available())
{
LcdWrite(LCD_D, Serial.read());
}
}
}

pnguin9999
 
Posts: 8
Joined: Tue Jun 11, 2013 4:53 am

Re: How do I send sensor data to a nokia 5110 lcd?

Post by pnguin9999 »

This is the LCD, works with the PCD test sketch.

Graphic LCD 84x48 - Nokia 5110
Attachments
sparkfun lcd.jpg
sparkfun lcd.jpg (33.6 KiB) Viewed 1356 times

1chicagodave
 
Posts: 564
Joined: Wed Jun 19, 2013 3:35 am

Re: How do I send sensor data to a nokia 5110 lcd?

Post by 1chicagodave »

pnguin9999 wrote:Thanks for the reply, I switched the order of includes and it now compiles and works in the serial monitor but still nothing on the LCD.

Code: Select all

#include <Adafruit_GFX.h>

#include <Adafruit_PCD8544.h>


/* ---------------------------------------------------------
* | Arduino Experimentation Kit Example Code |
* | CIRC-10 .: Temperature :. (TMP36 Temperature Sensor) |
* ---------------------------------------------------------
*
* A simple program to output the current temperature to the IDE's debug window
*
* For more details on this circuit: http://tinyurl.com/c89tvd
*/

//TMP36 Pin Variables
int temperaturePin = 0; //the analog pin the TMP36's Vout (sense) pin is connected to
//the resolution is 10 mV / degree centigrade
//(500 mV offset) to make negative temperatures an option

/*
* setup() - this function runs once when you turn your Arduino on
* We initialize the serial connection with the computer
*/
void setup()
{
Serial.begin(9600); //Start the serial connection with the copmuter
//to view the result open the serial monitor
//last button beneath the file bar (looks like a box with an antenae)


LcdInitialise();
SerialInitialise();
}
void loop() // run over and over again
{
float temperature = getVoltage(temperaturePin); //getting the voltage reading from the temperature sensor
temperature = (temperature - .5) * 100;
Serial.print(temperature); //converting from 10 mv per degree wit 500 mV offset
//to degrees ((volatge - 500mV) times 100)
Serial.println(" degrees centigrade"); //printing the result
delay(1000); //waiting a second
}

/*
* getVoltage() - returns the voltage on the analog input defined by
* pin
*/
float getVoltage(int pin){
return (analogRead(pin) * .004882814); //converting from a 0 to 1023 digital range
// to 0 to 5 volts (each 1 reading equals ~ 5 millivolts
}
#define SER_BAUD 9600

#define PIN_SCE 7
#define PIN_RESET 6
#define PIN_DC 5
#define PIN_SDIN 4
#define PIN_SCLK 3

#define LCD_C LOW
#define LCD_D HIGH

void LcdClear(void)
{
for (int index = 0; index < 84 * 48 / 8; index++)
{
LcdWrite(LCD_D, 0x00);
}
}

void LcdInitialise(void)
{
pinMode(PIN_SCE, OUTPUT);
pinMode(PIN_RESET, OUTPUT);
pinMode(PIN_DC, OUTPUT);
pinMode(PIN_SDIN, OUTPUT);
pinMode(PIN_SCLK, OUTPUT);
digitalWrite(PIN_RESET, LOW);
digitalWrite(PIN_RESET, HIGH);
LcdWrite(LCD_C, 0x22);
LcdWrite(LCD_C, 0x0C);
LcdClear();
}

void LcdWrite(byte dc, byte data)
{
digitalWrite(PIN_DC, dc);
digitalWrite(PIN_SCE, LOW);
shiftOut(PIN_SDIN, PIN_SCLK, MSBFIRST, data);
digitalWrite(PIN_SCE, HIGH);
}

void SerialInitialise(void) {
Serial.begin(SER_BAUD);
}

void SerialRead(void) {
if (Serial.available())
{
while (Serial.available())
{
LcdWrite(LCD_D, Serial.read());
}
}
}

Baby steps....at least it compiles!
8)

Yes, I have the same LCD. Or...the version that Adafruit sells (blue PCB).

***EDIT —

I don't see this anywhere in your code

Code: Select all


Adafruit_PCD8544 display = Adafruit_PCD8544(7, 6, 5, 4, 3);

....or any of the functions from the Adafruit library to write to the LCD.

What is this?

Code: Select all

void LcdWrite(byte dc, byte data)
{
digitalWrite(PIN_DC, dc);
digitalWrite(PIN_SCE, LOW);
shiftOut(PIN_SDIN, PIN_SCLK, MSBFIRST, data);
digitalWrite(PIN_SCE, HIGH)
That code wasn't written to use the Adafruit_PCD8544 library. The library does all that for you.

Look at the PCDtest sketch. It doesn't have any of that.
How does the PCDtest sketch write/print to the LCD?

pnguin9999
 
Posts: 8
Joined: Tue Jun 11, 2013 4:53 am

Re: How do I send sensor data to a nokia 5110 lcd?

Post by pnguin9999 »

Sorry. In have so many versions for different libraries that I posted the wrong one. Here is the one for Adafruit.

Code: Select all

#include <Adafruit_GFX.h>

#include <Adafruit_PCD8544.h>


Adafruit_PCD8544 display = Adafruit_PCD8544(7, 6, 5, 3, 4);

/*     ---------------------------------------------------------
 *     |  Arduino Experimentation Kit Example Code             |
 *     |  CIRC-10 .: Temperature :. (TMP36 Temperature Sensor) |
 *     ---------------------------------------------------------
 *   
 *  A simple program to output the current temperature to the IDE's debug window 
 * 
 *  For more details on this circuit: http://tinyurl.com/c89tvd 
 */
// pin 7 - Serial clock out (SCLK)
// pin 6 - Serial data out (DIN)
// pin 5 - Data/Command select (D/C)
// pin 4 - LCD chip select (CS)
// pin 3 - LCD reset (RST)

//TMP36 Pin Variables
int temperaturePin = 0; //the analog pin the TMP36's Vout (sense) pin is connected to
                        //the resolution is 10 mV / degree centigrade 
                        //(500 mV offset) to make negative temperatures an option

/*
 * setup() - this function runs once when you turn your Arduino on
 * We initialize the serial connection with the computer
 */
void setup()
{
  Serial.begin(9600);  //Start the serial connection with the computer
                       //to view the result open the serial monitor 
                       //last button beneath the file bar (looks like a box with an antennae)
                       
   display.begin();
  // init done

  // you can change the contrast around to adapt the display
  // for the best viewing!
  display.setContrast(50);

  display.display(); // show splashscreen
  delay(2000);
  display.clearDisplay();   // clears the screen and buffer

}
 
void loop()                     // run over and over again
{
 float temperature = getVoltage(temperaturePin);  //getting the voltage reading from the temperature sensor
 temperature = (((temperature - .5) * 100)*1.8) + 32;
                 //converting from 10 mv per degree wit 500 mV offset
                                                  //to degrees ((voltage - 500mV) times 100)
  Serial.println(temperature);                     //printing the result
 delay(1000);                                     //waiting a second
 
   
}

/*
 * getVoltage() - returns the voltage on the analog input defined by
 * pin
 */
float getVoltage(int pin){
 return (analogRead(pin) * .004882814); //converting from a 0 to 1023 digital range
                                        // to 0 to 5 volts (each 1 reading equals ~ 5 millivolts
}

pnguin9999
 
Posts: 8
Joined: Tue Jun 11, 2013 4:53 am

Re: How do I send sensor data to a nokia 5110 lcd?

Post by pnguin9999 »

I know pins 3 and 4 are switched but that is necessary to run the Sparkfun LCD with the Adafruit library. I have tried switching the wires just to see if it would work. Makes no difference to this program.

1chicagodave
 
Posts: 564
Joined: Wed Jun 19, 2013 3:35 am

Re: How do I send sensor data to a nokia 5110 lcd?

Post by 1chicagodave »

This could be a shot in the dark, but....

Code: Select all


int temperaturePin = 0; //the analog pin the TMP36's Vout (sense) pin is connected to

I believe is referring to DIGITAL PIN 0

If you want ANALOG PIN 0, it should read...

Code: Select all


int temperaturePin = A0; //the analog pin the TMP36's Vout (sense) pin is connected to


pnguin9999
 
Posts: 8
Joined: Tue Jun 11, 2013 4:53 am

Re: How do I send sensor data to a nokia 5110 lcd?

Post by pnguin9999 »

Finally got it, here is the code. Thanks for helping.

Code: Select all

// Article http://english.cxem.net/arduino/arduino7.php
 
#include "Adafruit_GFX.h"
#include "Adafruit_PCD8544.h"
 
#define VoltPin A0  // Voltage pin
//#define CurrPin A1  // Current pin
 
//float kVD = 5;  // Divider Ratio
//float kI = 1;   // Current Ratio - value of Rg resistor
 
// pin 7 - Serial clock out (SCLK)
// pin 6 - Serial data out (DIN)
// pin 5 - Data/Command select (D/C)
// pin 4 - LCD chip select (CS)
// pin 3 - LCD reset (RST)
Adafruit_PCD8544 display = Adafruit_PCD8544(7, 6, 5, 3, 4);
 
//TMP36 Pin Variables
int temperaturePin = 0; //the analog pin the TMP36's Vout (sense) pin is connected to
                        //the resolution is 10 mV / degree centigrade 
                        //(500 mV offset) to make negative temperatures an option
 
void setup()   {
  display.begin();
  display.setContrast(40);
  delay(1000);
  display.clearDisplay();     // clears the screen and buffer
  display.setTextSize(1);     // set text size
  display.setTextColor(BLACK);
  delay(1000);
}
 
void loop() {
  float temperature = getVoltage(temperaturePin);  //getting the voltage reading from the temperature sensor
  temperature = (((temperature - .5) * 100)*1.8) + 32;
                 //converting from 10 mv per degree wit 500 mV offset
                                                  //to degrees ((volatge - 500mV) times 100)
   
  display.clearDisplay();              // clears the screen and buffer
  display.setCursor(0,0);
   
  display.print("Temperature=");
  display.println(temperature);
  display.println();
   
  
   
  display.display();
   
  delay(500);
}  
  float getVoltage(int pin){
 return (analogRead(pin) * .004882814); //converting from a 0 to 1023 digital range
                                        // to 0 to 5 volts (each 1 reading equals ~ 5 millivolts
}

pnguin9999
 
Posts: 8
Joined: Tue Jun 11, 2013 4:53 am

Re: How do I send sensor data to a nokia 5110 lcd?

Post by pnguin9999 »

Wiring for 5110 lcd is;
led= through 560 ohm resistor to 3.3VDC
sclk= pin 7
dnk mosi (serial in)= pin 6
d/c= pin 5
rst= pin 4
sce= pin 3
gnd= ground
vcc= 3.3VDC

Wiring for tmp36 temperature sensor is;
looking at flat face of sensor
right pin to ground
center pin to A0
left pin to 5VDC

pnguin9999
 
Posts: 8
Joined: Tue Jun 11, 2013 4:53 am

Re: How do I send sensor data to a nokia 5110 lcd?

Post by pnguin9999 »

Code was originally for a volt/current meter I just commented those parts out and added the temperature code.

User avatar
liquidlogic
 
Posts: 12
Joined: Wed Jan 01, 2014 5:23 pm

Re: How do I send sensor data to a nokia 5110 lcd?

Post by liquidlogic »

I'm having trouble understanding the following:

float getVoltage(int pin){
return (analogRead(pin) * .004882814);

Specifically, the (int pin) and subsequent analogRead(pin).

How does the program know that the variable "pin" is connected to the analog pin A0? The only one defined thus far was temperaturePin = 0.

Can anyone explain this in a little more detail why you would use "pin" instead of "temperaturePin", and how or where "pin" is connected to the analog pin A0 in the program?

Thanks!

1chicagodave
 
Posts: 564
Joined: Wed Jun 19, 2013 3:35 am

Re: How do I send sensor data to a nokia 5110 lcd?

Post by 1chicagodave »

Liquidlogic wrote:I'm having trouble understanding the following:

float getVoltage(int pin){
return (analogRead(pin) * .004882814);

Specifically, the (int pin) and subsequent analogRead(pin).

How does the program know that the variable "pin" is connected to the analog pin A0? The only one defined thus far was temperaturePin = 0.

Thanks!
Right, this is just a function declaration (or "definition").

Code: Select all

  float getVoltage(int pin){
 return (analogRead(pin) * .004882814); //converting from a 0 to 1023 digital range
                                        // to 0 to 5 volts (each 1 reading equals ~ 5 millivolts
It creates or defines a function (piece of code that does something specific when called) and the terms in () after the function name is called a parameter. A parameter is another variable or placeholder to tell you what kind of value it needs in order to operate correctly. This specific function takes an integer (basically, a whole number..not a decimal or fraction or word) as it's parameter and passes that along to the variable with the same name 'pin'[/i] inside of the function.
As I mentioned, this is just the function declaration. One way to tell is that it exists outside of the main program loop(). If you scroll up a bit in the code, you will find this -

Code: Select all

 float temperature = getVoltage(temperaturePin);  //getting the voltage reading from the temperature sensor
and if you scroll up a bit more, you'll find this -

Code: Select all

//TMP36 Pin Variables
int temperaturePin = 0; //the analog pin the TMP36's Vout (sense) pin is connected to
Can anyone explain this in a little more detail why you would use "pin" instead of "temperaturePin", and how or where "pin" is connected to the analog pin A0 in the program?
[\quote]

Good call, they did use 'temperaturePin'....and it does make more sense.
The times the pin is referenced by different names are just spread out throughout the sketch.


**EDIT - OH, and the last bit of your question. Since the actual 'Arduino function' which is being called is analogRead(temperaturePin), even though temperaturePin == 0 instead of 'A0', the compiler is smart enough to figure out that the analogRead() function will not work on Digital Pin 0 and kinda assumes you meant 'A0'.

This link was invaluable to me when I first started out with Arduino and programming -
http://arduino.cc/en/Reference/HomePage
I often had to look up the same thing a few times every day! :roll:

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”