Go Down

Topic: 'digitalwrite' was not declared in this scope (Read 5923 times) previous topic - next topic

dmillerw

Just got my first Arduino, and am just taking my first few steps into the world of electronics.

Code: [Select]
int sensorPin = 0;    // select the input pin for the photocell
int sensorValue = 0;  // variable to store the value coming from the photocell
int LEDpin = 8; //LED Pin is on the Digital i/o pin number 8

void setup() {
  Serial.begin(9600);      //Set baud rate to 9600 on the Arduino
  pinMode(LEDpin, OUTPUT); //set the LED pin as an output on digital i/o pin 8
}

void loop() {

  sensorValue = analogRead(sensorPin);  //get the value from input pin
  Serial.println(sensorValue);  //print the value to Serial monitor
  delay(2000);

      if (sensorValue < 50) //if there is darkness then turn led on

      {
        digitalwrite(LEDpin,HIGH);
      }
      else
      {
       digitalwrite(LEDpin, LOW);  //else, keep the led off
      }

}


Just using this example sketch, but I keep getting this error.

Quote
error: 'digitalwrite' was not declared in this scope


Any help?

johnwasser

It's spelled "digitalWrite".  Identifiers are case sensitive.
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

Go Up