BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

STM32F103C8 Based board & Blynk

I am developing code, under the Arduino IDE v, 1.6.12. So far, thinks are working on the board, however, when I introduced Blynk code, I am getting an error that ‘Blynk’ was not declared in this scope:

define BLYNK_DEBUG
include <ESP8266_HardSer.h>
include “C:\Users\fredmatic1\Documents\Arduino\libraries\BlynkESP8266_HardSer\ESP8266_HardSer.h”
include <SimpleTimer.h>#include <stdlib.h>

SimpleTimer timer;

define EspSerial Serial1 // defines the ESP8266-05/01
define BLYNK_PRINT Serial

Any call utilizing Blynk functions… like:

Blynk.begin(auth, wifi, “netname”, “password”);

ends with:

C:\Users\fredmatic1\Documents\Arduino\ESP8266_Shield_HardSer_Upstairs_STM32v00\ESP8266_Shield_HardSer_Upstairs_STM32v00.ino\ESP8266_Shield_HardSer_Upstairs_STM32v00.ino.ino: In function ‘void setup()’:

ESP8266_Shield_HardSer_Upstairs_STM32v00.ino:135: error: ‘Blynk’ was not declared in this scope

Blynk.begin(auth, wifi, “netname”, “password”);

I have yet to figure out why… any help??

thanx in advance… mark

Should just be #include <ESP8266_HardSer.h>. Looks like badly installed libaries

no, I took the # out of the listings. There is a # for every include and define…when in the text, the text became huge, so i took out the #. So, I am not understanding why it won’t find anything Blynk. Like Blynk.begin or Blynk.run. It errors in the compiler…it tells me that Blynk was not declared…

Format your code correctly so we can read it.

```cpp
CODE
```

Ok… here it is in the raw…

#define BLYNK_DEBUG

#include “C:\Users\fredmatic1\Documents\Arduino\libraries\BlynkESP8266_HardSer\ESP8266_HardSer.h”
#include <SimpleTimer.h>
#include <stdlib.h>

SimpleTimer timer;

// Set ESP8266 Serial object
#define EspSerial Serial1 // defines the ESP8266-05/01 modules connections are on Serial1, (Tx1/Rx1)
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space

#define pinLED PC13
#define RGBred 6
#define RGBgreen 5
#define RGBblue 9

void setup(void);
void loop(void);
void readtemp(void);
void send_data(void);
void send_graph_data(void);
void temperature_control(void);
void writeColor(unsigned char *color);
void sendUptime(void);
void send_to_thingspeak(float tempdata);
void update(String value, String field);
char * floatToString(char * outstr, float value, int places, int minwidth, bool rightjustify);

void setup()
{
Serial.begin(115200);
pinMode(pinLED, OUTPUT);
Serial.println(“START”);
pinMode(RGBred, PWM);
pinMode(RGBgreen, PWM);
pinMode(RGBblue, PWM);

delay(2000);
EspSerial.begin(115200); // Set for ESP-05
delay(1000);
CurrentColor = &Blue[0];
writeColor(CurrentColor);

Blynk.begin(auth, wifi, “Netgear38”, “aquaticonion1”);
CurrentColor = &briteRed[0];
writeColor(CurrentColor);
while (Blynk.connect() == false); // Wait until connected

timer.setInterval(2500L, sendData); // update everything every 2.5 second
timer.setInterval(200L, check_usb); // check for console connection every 200 msecs
timer.setInterval(500L, toggle_led_color); // toggle RGB led color every 500 msecs
Blynk.virtualWrite(11, 0);

Then we have the error…

“C:\Users\fredmatic1\AppData\Local\Arduino15\packages\ExploreM3\tools\arm-none-eabi-gcc\4.8.3-2014q1/bin/arm-none-eabi-g++” -c -g -Os -w -DDEBUG_LEVEL=DEBUG_NONE -MMD -ffunction-sections -fdata-sections -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -DBOARD_generic_stm32f103c -DVECT_TAB_ADDR=0x8000000 -DERROR_LED_PORT=GPIOB -DERROR_LED_PIN=1 -mcpu=cortex-m3 -DF_CPU=72000000L -DARDUINO=10612 -DARDUINO_GENERIC_STM32F103C -DARDUINO_ARCH_STM32F1 -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG -DMCU_STM32F103C8 -mthumb -march=armv7-m -D__STM32F1__ -DMCU_STM32F103C8 -mthumb -march=armv7-m -D__STM32F1__ “-IC:\Users\fredmatic1\Documents\Arduino\hardware\Arduino_STM32-master\STM32F1\system/libmaple” “-IC:\Users\fredmatic1\Documents\Arduino\hardware\Arduino_STM32-master\STM32F1\system/libmaple/include” “-IC:\Users\fredmatic1\Documents\Arduino\hardware\Arduino_STM32-master\STM32F1\system/libmaple/stm32f1/include” “-IC:\Users\fredmatic1\Documents\Arduino\hardware\Arduino_STM32-master\STM32F1\system/libmaple/usb/stm32f1” “-IC:\Users\fredmatic1\Documents\Arduino\hardware\Arduino_STM32-master\STM32F1\system/libmaple/usb/usb_lib” “-IC:\Users\fredmatic1\Documents\Arduino\hardware\Arduino_STM32-master\STM32F1\cores\maple” “-IC:\Users\fredmatic1\Documents\Arduino\hardware\Arduino_STM32-master\STM32F1\variants\generic_stm32f103c” “-IC:\Users\fredmatic1\Documents\Arduino\libraries\SimpleTimer” “C:\Users\FREDMA~1\AppData\Local\Temp\arduino_build_413840\sketch\ESP8266_Shield_HardSer_Upstairs_STM32v00.ino.ino.cpp” -o “C:\Users\FREDMA~1\AppData\Local\Temp\arduino_build_413840\sketch\ESP8266_Shield_HardSer_Upstairs_STM32v00.ino.ino.cpp.o”
C:\Users\fredmatic1\Documents\Arduino\ESP8266_Shield_HardSer_Upstairs_STM32v00\ESP8266_Shield_HardSer_Upstairs_STM32v00.ino\ESP8266_Shield_HardSer_Upstairs_STM32v00.ino.ino: In function ‘void setup()’:

ESP8266_Shield_HardSer_Upstairs_STM32v00.ino:135: error: ‘Blynk’ was not declared in this scope

Pretty.

As you can see, with the # included for the ‘includes’ and for the ‘defines’, it blows up the text. Everything other than those is ‘as is’.

what do you mean by:

‘’’’’ cpp
code
‘’’’

backticks, 3 of these ` as per the guidelines.
Don’t expect anyone to look through invisible code.

Just copy and paste my example and replace CODE with your full sketch

I think I finally got it… I am programmer and not a help board user often… (as in rarely):

>>>>>>>>>> Then the errors begin… <<<<<<<<<<<<<

i think maybe the problem is with this line:

#include "C:\Users\fredmatic1\Documents\Arduino\libraries\BlynkESP8266_HardSer\ESP8266_HardSer.h"

and also, you have 2 “empty” includes after that:

#include "C:\Users\fredmatic1\Documents\Arduino\libraries\BlynkESP8266_HardSer\ESP8266_HardSer.h"

#include

#include 
SimpleTimer timer;

I will check that this evening, but I do believe that is a copy error, as I do not remember ANY blank includes…

So, what might you think to be the error in the first include? That is the actual path to the ESP8266_HardSer.h file. Including the actual path took away a different ‘file not found’ error.

@fredmatic1 the include statements are shown wrong because you are not using forum formatting for your sketch i.e. backticks. See animated gif at [README] Welcome to Blynk Community!

Good gracious, here is the code formatted…


#define BLYNK_DEBUG

#include "C:\Users\fredmatic1\Documents\Arduino\libraries\BlynkESP8266_HardSer\ESP8266_HardSer.h"
#include <SimpleTimer.h>
#include <stdlib.h>

SimpleTimer timer;

// Set ESP8266 Serial object
#define EspSerial Serial1                               // defines the ESP8266-05/01 modules connections are on Serial1, (Tx1/Rx1)
#define BLYNK_PRINT Serial                              // Comment this out to disable prints and save space


// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxxx";                   // Key for Blynk 'Upstairs' API

//String apiKey = "xxxxx";                                   // TC Arduino Key
String apiKey = "xxxxxx";                                   // TC Upstairs Key

#define IP "184.106.153.149" // thingspeak.com IP address; see their website for more detail
//String GET = "GET /update?api_key=xxxxxxx"; // you channel will have unique code   Grand Rapids
String GET = "GET /update?api_key=xxxxxx"; // you channel will have unique code  Traverse City
String field1="&field1=";
String field2="&field2=";
String field3="&field3=";

#define pinLED PC13

#define RGBred      6
#define RGBgreen    5
#define RGBblue     9

unsigned char   Black[] = {0, 0, 0};
unsigned char   dimWhite[] = {8, 8, 8};
unsigned char   White[] = {30, 30, 30};
unsigned char   briteWhite[] = {60, 60, 60};
unsigned char   Blue[] = {0, 0, 20};
unsigned char   briteBlue[] = {0, 0, 50};
unsigned char   Red[] = {20, 0, 0};
unsigned char   briteRed[] = {50, 0, 0};
unsigned char   Cyan[] = {0, 20, 20};
unsigned char   briteCyan[] = {0, 50, 50};
unsigned char   Yellow[] = {20, 20, 0};
unsigned char   Violet[] = {10, 0, 20};
unsigned char   Lime[] = {0, 20, 0};
unsigned char   Orange[] = {30, 7, 0};

unsigned char   *AltColor, *CurrentColor;

void setup(void);
void loop(void);
void readtemp(void);
void send_data(void);
void send_graph_data(void);
void temperature_control(void);
void writeColor(unsigned char *color);
void sendUptime(void);
void send_to_thingspeak(float tempdata);
void update(String value, String field);
char * floatToString(char * outstr, float value, int places, int minwidth, bool rightjustify);


void setup() 
{
  Serial.begin(115200);
  pinMode(pinLED, OUTPUT);
  Serial.println("START"); 
  pinMode(RGBred, PWM);
  pinMode(RGBgreen, PWM);
  pinMode(RGBblue, PWM);

  
  delay(1000);
  CurrentColor = &White[0];
  writeColor(CurrentColor);
  delay(2000);

  // Set ESP8266 baud rate
  //EspSerial.begin(9600);                                          // Set for ESP-01
  EspSerial.begin(115200);                                      // Set for ESP-05
  delay(1000);
  CurrentColor = &Blue[0];
  writeColor(CurrentColor);
  
  Blynk.begin(auth, wifi, "yyyy", "yyyy");
  //Blynk.begin(auth, wifi, "yyyy", "yyyy");
  CurrentColor = &briteRed[0];
  writeColor(CurrentColor);
  while (Blynk.connect() == false);                               // Wait until connected

  timer.setInterval(2500L, sendData);                             // update everything every 2.5 second
  timer.setInterval(200L, check_usb);                             // check for console connection every 200 msecs
  timer.setInterval(500L, toggle_led_color);                      // toggle RGB led color every 500 msecs

  CurrentColor = &Lime[0];
  writeColor(CurrentColor);
  yield;
  Blynk.virtualWrite(11, 0);
}

void loop() 
{
  //Blynk.run();
  timer.run();  
}

>>>>>>>    ERROR CONDITION BELOW  <<<<<<<<<<<<<<<<<<

C:\Users\fredmatic1\Documents\Arduino\ESP8266_Shield_HardSer_Upstairs_STM32v00\ESP8266_Shield_HardSer_Upstairs_STM32v00.ino\ESP8266_Shield_HardSer_Upstairs_STM32v00.ino.ino: In function 'void setup()':

ESP8266_Shield_HardSer_Upstairs_STM32v00.ino:135: error: 'Blynk' was not declared in this scope



@fredmatic1, oh man…
The hardser/softser approach was removed a long time ago.
Current blynk examples include

#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
  1. remove old blynk libraries
  2. install new blynk libraaries
  3. run new blynk example
  4. modify your existing sketch according to new example

Hope that helps!

Thank you very much. I guess I never had a need to upgrade this because they worked great already. Unfortunately, this is going to have to wait till this evening as I am at work now. I wish I had known this days ago…but at least it has caused me to uninstall everything, then re-install Arduino 1.8.1, (a definite jump from what I was using), and all the other addons.

Thanx again and I WILL be trying this tonight.

mark