Go Down

Topic: LED was not declared in this scope (Read 88 times) previous topic - next topic

syafiqkemz

Hello I have a problem with this code and i cant seem to find the solution . Any help is appreciated .
Quote
#include <SoftwareSerial.h> //Software Serial Port
//Version 1
#define RxD 5 // This is the pin that the Bluetooth (BT_TX) will transmit to the Arduino (RxD)
#define TxD 6 // This is the pin that the Bluetooth (BT_RX) will receive from the Arduino (TxD)

SoftwareSerial blueToothSerial(RxD,TxD);

//IO Declaration


void setup() {
 
  //declaration
  blueToothSerial.begin(9600);
  Serial.begin(9600); // Allow Serial communication via USB cable to computer (if required)
 

}
void loop() {
 
 char recvChar; //Variable to store received character
 

 while(blueToothSerial.available()>0)
 {
    recvChar = blueToothSerial.read();
     Serial.println(recvChar); // Print the character received to the Serial Monitor (if required)
      //If the character received = 'a' , then turn on LED
     if(recvChar=='a'){
       digitalWrite(LED01, HIGH);
        //Serial.println("a received. LED ON");
        blueToothSerial.println("ON");
     }else if ( recvChar=='b'){
        digitalWrite(LED01, LOW);
       // Serial.println("b received. LED OFF");
       blueToothSerial.println("OFF");
     }
     
   }//end while

}

dannable

Please use [code][/code] tags for code, not quote tags.

Code: [Select]
       digitalWrite(LED01, HIGH);

I cannot see where you have declared LED01?
Beginners guide to using the Seeedstudio SIM900 GPRS/GSM Shield

JimboZA

Please use [code][/code] tags for code, not quote tags.

Code: [Select]
       digitalWrite(LED01, HIGH);

I cannot see where you have declared LED01?
Not only that, but once it is declared it should be pinMode'd as an OUTPUT.
meArm build blog:     http://jimbozamearm.blogspot.com/

Please don't PM for technical advice. Firstly my advice is sometimes wrong, and second, in the forum you get a broader, more timely, range of responses.

kocickamia

Code: [Select]

#include <SoftwareSerial.h> //Software Serial Port
//Version 1
#define RxD 5 // This is the pin that the Bluetooth (BT_TX) will transmit to the Arduino (RxD)
#define TxD 6 // This is the pin that the Bluetooth (BT_RX) will receive from the Arduino (TxD)

SoftwareSerial blueToothSerial(RxD,TxD);

//IO Declaration --> here must be defined LED01
#define LED01 13    //LED01 is connected to pin 13


void setup() {
 
  //declaration
  blueToothSerial.begin(9600);
  Serial.begin(9600); // Allow Serial communication via USB cable to computer (if required)
  //here must be set mode of LED01 pin
  pinMode(LED01,OUTPUT);



ieee488


Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy