Go Down

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


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

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

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


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

error: 'digitalwrite' was not declared in this scope

Any help?


It's spelled "digitalWrite".  Identifiers are case sensitive.
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp
See who has no social life: https://forum.arduino.cc/index.php?action=stats :)

Go Up