Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: [1]  Send TopicPrint
Very Hot Topic (More than 25 Replies) Blynk, ESP8266 NodeMCU use with Visual Micro (Read 20334 times)
arduinoUser2
Junior Member
**
Offline


Posts: 41
Joined: Dec 30th, 2015
Blynk, ESP8266 NodeMCU use with Visual Micro
Nov 7th, 2017 at 4:00pm
Print Post  
Using Visual Studio Community 2017.
Board: HiLetgo ESP8266 NodeMCU LUA CP2102 ESP-12E

I am trying to run a simple Blynk,
http://www.blynk.cc/, application.  The application works with the straight Arduino IDE.  With VS and Visual Micro the same code compiles and uploads, but does not work, i.e., the Blynk application on my Android tablet never contacts the Blynk server, as it does when using the Arduino IDE.

In the Arduino IDE the "Programmer" is listed as "AVRISP mkll".  I cannot find a similar setting or choice in the Visual Micro menus within Visual Studio.

Is there a setting I am missing or an incompatibility?
  
Back to top
 
IP Logged
 
arduinoUser2
Junior Member
**
Offline


Posts: 41
Joined: Dec 30th, 2015
Re: Blynk, ESP8266 NodeMCU use with Visual Micro
Reply #1 - Nov 7th, 2017 at 6:05pm
Print Post  
FWIW, I got the Visual Studio/Visual Micro code to run 1 time out of about 10 tries.  I would then stop the code and try to compile and upload again, without changing the code, and it would not work.

Some time ago I was experimenting with the plain ESP8266 module and Visual Studio / Visual Micro connected with the correct interface.  It would do the same thing, work, then not work.

The Arduino IDE works every time.  I think that Visual Micro "reaches out" and uses the installed Arduino IDE's code.  I am thus at a loss as to why Visual Studio / Visual Micro is so pernickety by comparison.
  
Back to top
 
IP Logged
 
Tozapid
Newbies
*
Offline


Posts: 7
Joined: Nov 8th, 2017
Re: Blynk, ESP8266 NodeMCU use with Visual Micro
Reply #2 - Nov 8th, 2017 at 6:22pm
Print Post  
Hi, you can try my way - http://www.visualmicro.com/forums/YaBB.pl?num=1510147192/0#5
I turn off debug mode
  
Back to top
 
IP Logged
 
arduinoUser2
Junior Member
**
Offline


Posts: 41
Joined: Dec 30th, 2015
Re: Blynk, ESP8266 NodeMCU use with Visual Micro
Reply #3 - Nov 8th, 2017 at 10:52pm
Print Post  
Tozapid,

I tried your suggestion, and it does work.  I got the same result by setting Visual Studio to compile "Release".

However, I want the debugger functionality.  Have you figured out how to get the debugger to work?  For some reason, mine will work one time in five to ten tries.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Blynk, ESP8266 NodeMCU use with Visual Micro
Reply #4 - Nov 10th, 2017 at 6:00am
Print Post  
Sorry for the delay.

The programmer selection in the arduino ide can be ignored. it is not used by the arduino ide unless you click "upload using programmer"

Are you trying to debug using Serial?

Is your upload method Serial or OTA?

Which version is esp core?

Thanks
  
Back to top
WWW  
IP Logged
 
arduinoUser2
Junior Member
**
Offline


Posts: 41
Joined: Dec 30th, 2015
Re: Blynk, ESP8266 NodeMCU use with Visual Micro
Reply #5 - Nov 10th, 2017 at 3:36pm
Print Post  
Tim@Visual Micro wrote on Nov 10th, 2017 at 6:00am:
The programmer selection in the arduino ide can be ignored. it is not used by the arduino ide unless you click "upload using programmer"

Tim, Thanks for your queries.

Are you trying to debug using Serial?  If I understand this correctly, I am trying to use the serial monitor to see what the code is doing by inserting breakpoints in the code.

Is your upload method Serial or OTA?
All the uploads have been via serial connection not over the air.

Which version is esp core?  ESP-12E

The problem seems to be in making the WiFi connection.  For Blynk and earlier experiments with the original ESP8266, the code gets "stuck" and does not return from the command to connect to WiFi with "Debug" compiled code.  Even though I am interacting with the NodeMCU module via a wired, serial connection, the uploaded code on the NodeMCU must connect to my router via WiFi.  This is seamless for "Release" compilations, but fraught with difficulties for "Debug" compilations.  When using the original ESP8266 a while back I had the same problem, viz., only sporadic connection to the WiFi router.  At that earlier time it was always with "Debug" compilations as I had not discovered that "Release" configurations did not and do not have this problem.


  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Blynk, ESP8266 NodeMCU use with Visual Micro
Reply #6 - Nov 10th, 2017 at 4:16pm
Print Post  
Ah okay. If I recall the esp core fails to connect to wifi if the delay(millis) syntax is used before the wifi connects. 

The debugger normally uses  a short delay to wait a small time, to ensure the ide has started listening for debug. 

Because of this issue, normally for esp visual micro skips the delay(). However your report suggests that in recent versions of visual micro the "delay()" is being applied for esp.

I will check for the next release thanks
  
Back to top
WWW  
IP Logged
 
arduinoUser2
Junior Member
**
Offline


Posts: 41
Joined: Dec 30th, 2015
Re: Blynk, ESP8266 NodeMCU use with Visual Micro
Reply #7 - Nov 12th, 2017 at 5:34pm
Print Post  
Tim,

Thanks for the feedback.

Not to be a pest, but have you any idea how long before this issue will be corrected in a new release of Visual Micro?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Blynk, ESP8266 NodeMCU use with Visual Micro
Reply #8 - Nov 12th, 2017 at 6:19pm
Print Post  
prob over next week or two.
  
Back to top
WWW  
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Blynk, ESP8266 NodeMCU use with Visual Micro
Reply #9 - Nov 18th, 2017 at 4:45pm
Print Post  
There will be an update over the next few days. I have removed a delay() command from the esp debug startup which might be the cause of the wifi connect issue.

I have also updated the visualmicro.com esp8266 page with my test example which works in both wifi and serial mode.

So it will be useful for you to use the same test thanks. 

I found it worked in both release and serial upload/debug mode. The code I use also waits for the IP address to be established and gives useful serial messages to see what is happening during boot.

  
Back to top
WWW  
IP Logged
 
arduinoUser2
Junior Member
**
Offline


Posts: 41
Joined: Dec 30th, 2015
Re: Blynk, ESP8266 NodeMCU use with Visual Micro
Reply #10 - Nov 20th, 2017 at 10:46pm
Print Post  
Tim,

I have tried the new version, 1711.19.0, and it no longer stalls when connecting to WiFi.

I am trying to design two applications with Blynk,
http://www.blynk.cc/.  For Release code, neither display the results of Serial.print.  In Debug code, one will show both Serial.print output and messages associated with breakpoints, the other will show neither.

I cannot see any differences in the code that would cause a basic thing like Serial.print (or println) to fail, or why it would be different between two applications.  I have no idea if this is related to Visual Micro, but I thought I'd ask.

Thanks for the quick turnaround on the latest release.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Blynk, ESP8266 NodeMCU use with Visual Micro
Reply #11 - Nov 21st, 2017 at 2:31am
Print Post  
what speed are you setting in serial.begin() ?

are you terminating your prints with println(ln) or \r\n?
« Last Edit: Nov 21st, 2017 at 2:32am by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
arduinoUser2
Junior Member
**
Offline


Posts: 41
Joined: Dec 30th, 2015
Re: Blynk, ESP8266 NodeMCU use with Visual Micro
Reply #12 - Nov 21st, 2017 at 12:34pm
Print Post  
For Serial.Begin() I have tried both 9600 and 115200.

I have NOT been terminating my prints with either println(ln) or \r\n.  Do you recommend that I do so?
  
Back to top
 
IP Logged
 
arduinoUser2
Junior Member
**
Offline


Posts: 41
Joined: Dec 30th, 2015
Re: Blynk, ESP8266 NodeMCU use with Visual Micro
Reply #13 - Nov 21st, 2017 at 2:00pm
Print Post  
Tim,

I have tried to find println(ln) and cannot.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Blynk, ESP8266 NodeMCU use with Visual Micro
Reply #14 - Nov 21st, 2017 at 3:20pm
Print Post  
You should terminate the serial prints otherwise the serial monitor will not know when to show data. It should still show the data but be less responsive.

If you have not read the documentation for the arduino ide then you should be aware that your serial.begin speed should match the speed that is selected on the lower button panel of the serial monitor. The default is 115200 so stick with that until you know what you are doing.

In release mode at 9600 you won't see any data if the monitor is set to 115200

In debug mode visual micro automatically attempts to discover the speed your code is using or it defaults to 115200


serial.print("Hi")
serial.print(" there\r\n")

serial.println("Hi there")

serial.print("hi there")
serial.println()
« Last Edit: Nov 21st, 2017 at 3:28pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
arduinoUser2
Junior Member
**
Offline


Posts: 41
Joined: Dec 30th, 2015
Re: Blynk, ESP8266 NodeMCU use with Visual Micro
Reply #15 - Nov 21st, 2017 at 3:41pm
Print Post  
Tim,

I know that.  In your note of yesterday at 9:31pm you asked if I was "terminating your prints with println(ln)".  I do not know, nor could I find a reference to, "println(ln)" function.  It looks to me like it is a typo, but I am not sure.

This morning (USA) I have tried various things with no luck.  I have added "\r\n" to print(), I have added println() after print() statements, etc..

Also, breakpoint messages are not coming through.  For example, I put a breakpoint message at the beginning of loop() to trigger when "millis() % 5000UL == 0" and display "loop() running", but the message never appears.

Even fixed breakpoints, i.e., stop at this line, do not work.

I have tried the code directly in the Arduino IDE standalone and the print functions do not print there either.  That is only a "Release" version, so to speak.

That one application using Visual Micro will Serial print, at least some of the time, and another will not is puzzling and appears to be beyond anything I can figure out.

It appears to me that something is interfering with the the Serial call or the Serial.print call.  That debug breakpoint messages do not get through may be related, but I do not know.  That is, something deep is going on.  The Blynk people, per a forum post, say that their code is just an adder, i.e., it does nothing to change the Arduino functions in question.
  
Back to top
 
IP Logged
 
arduinoUser2
Junior Member
**
Offline


Posts: 41
Joined: Dec 30th, 2015
Re: Blynk, ESP8266 NodeMCU use with Visual Micro
Reply #16 - Nov 21st, 2017 at 4:01pm
Print Post  
Tim,

Further to my post of a few minutes ago, I just found that the a breakpoint set to stop execution at a line will work in the setup() function, and show in the "Micro Debug Trace" window as stopped at the given line.

A stop execution breakpoint in the loop() function stops execution, with with NO indication in the "Micro Debug Trace" window.  Further, I could not examine the current values of the variables when it had stopped.  The right-click menu looked as it does when the program is not running.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Blynk, ESP8266 NodeMCU use with Visual Micro
Reply #17 - Nov 21st, 2017 at 4:04pm
Print Post  
Have you ever used the debugger before?

Please give screen shot of full ide with status bar, trace and code when the break point is stopped in the loop.

Does click the "Continue execution" on the breakpoint properties and also adding a "message" to the breakpoint show correctly in the trace when the app is running?
  
Back to top
WWW  
IP Logged
 
arduinoUser2
Junior Member
**
Offline


Posts: 41
Joined: Dec 30th, 2015
Re: Blynk, ESP8266 NodeMCU use with Visual Micro
Reply #18 - Nov 21st, 2017 at 6:02pm
Print Post  
Tim wrote: Have you ever used the debugger before?

Yes.

Tim wrote: Please give screen shot of full ide with status bar, trace and code when the break point is stopped in the loop.

The two images are successive runs of the program.  In the first image the breakpoint shown has no message associated with it.  In the second, there is a message associated with it.  In both cases, the execution is to stop at that line.

Tim wrote: Does click the "Continue execution" on the breakpoint properties and also adding a "message" to the breakpoint show correctly in the trace when the app is running?

When the code stops, as shown in the attached two screenshots, the “Continue execution” button on the VMicro toolbar is grayed-out.  Adding a message to the breakpoint displays nothing in the “Micro Debug Trace” output window, as shown in the second image.

  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
arduinoUser2
Junior Member
**
Offline


Posts: 41
Joined: Dec 30th, 2015
Re: Blynk, ESP8266 NodeMCU use with Visual Micro
Reply #19 - Nov 21st, 2017 at 11:14pm
Print Post  
Tim,

I sent the two screen shots in the last post.  I have also played with the application while following the Visual Micro instructions for debugging, just to be sure I was not missing something basic.  No change.

I said in the original post that I am using a "HiLetgo ESP8266 NodeMCU LUA CP2102 ESP-12E" board.  Since it is compiling and running properly, I am guessing that that is not the problem.  I just wanted to bring it up again to be sure.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Blynk, ESP8266 NodeMCU use with Visual Micro
Reply #20 - Nov 22nd, 2017 at 12:58pm
Print Post  
Well let's work without debug until you clear up the serial issues.

You should see a "loop running" in the serial monitor every 5 seconds. I don't see that in your screen shot. In fact it looks like some has tried to write binary or non ascii to the serial output.
  
Back to top
WWW  
IP Logged
 
arduinoUser2
Junior Member
**
Offline


Posts: 41
Joined: Dec 30th, 2015
Re: Blynk, ESP8266 NodeMCU use with Visual Micro
Reply #21 - Nov 22nd, 2017 at 2:31pm
Print Post  
Tim,

I have removed all the breakpoints from the code, just to eliminate any possible issue.  The compiler has been set to "Release".  Still, no output from the Serial print commands.

I know the loop() is running since the other part of the Blynk application is on an android tablet.  The display on the tablet changes as particular GPIO pins on the NodeMCU have their digital states changed.  That can only happen if the loop() is looping.

Current screenshot image is attached.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Blynk, ESP8266 NodeMCU use with Visual Micro
Reply #22 - Nov 22nd, 2017 at 7:27pm
Print Post  
pls email your code to info[at]visualmicro.com

Thanks
  
Back to top
WWW  
IP Logged
 
arduinoUser2
Junior Member
**
Offline


Posts: 41
Joined: Dec 30th, 2015
Re: Blynk, ESP8266 NodeMCU use with Visual Micro
Reply #23 - Nov 22nd, 2017 at 9:10pm
Print Post  
Sent, per your request.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Blynk, ESP8266 NodeMCU use with Visual Micro
Reply #24 - Nov 22nd, 2017 at 10:43pm
Print Post  
please generate an autoCode for an esp8266 HUZZA so i can test


Thanks
« Last Edit: Nov 22nd, 2017 at 10:44pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
arduinoUser2
Junior Member
**
Offline


Posts: 41
Joined: Dec 30th, 2015
Re: Blynk, ESP8266 NodeMCU use with Visual Micro
Reply #25 - Nov 22nd, 2017 at 10:49pm
Print Post  
Tim,

I do not understand what you are asking for.  What is autocode for an esp8266 HUZZA?
  
Back to top
 
IP Logged
 
arduinoUser2
Junior Member
**
Offline


Posts: 41
Joined: Dec 30th, 2015
Re: Blynk, ESP8266 NodeMCU use with Visual Micro
Reply #26 - Nov 22nd, 2017 at 11:29pm
Print Post  
Tim,

I guessed that you want the .bin files complied of my project for the Huzzah ESP8266 board.  I emailed them a few minutes ago to the address you previously provided.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Blynk, ESP8266 NodeMCU use with Visual Micro
Reply #27 - Nov 23rd, 2017 at 6:38pm
Print Post  
I need an authcode for the blynk service and the one in your code was rejected I will try your email over the next day or so thanks.
  
Back to top
WWW  
IP Logged
 
arduinoUser2
Junior Member
**
Offline


Posts: 41
Joined: Dec 30th, 2015
Re: Blynk, ESP8266 NodeMCU use with Visual Micro
Reply #28 - Nov 27th, 2017 at 2:48pm
Print Post  
Tim,

FWIW, Blynk has some virtual items which will appear in the Android control portion of the system.  I placed virtual LEDs in the code where I also had Serial.println() statements.  The LEDs all lit when that portion of the code was called, but I never saw any response from the print functions.  And that was for "Release" compile.  Blynk also has print-like functions, which again display on the Android side.  These all work in my application.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Blynk, ESP8266 NodeMCU use with Visual Micro
Reply #29 - Nov 27th, 2017 at 9:24pm
Print Post  
Does all the serial show in the arduino ide?
  
Back to top
WWW  
IP Logged
 
arduinoUser2
Junior Member
**
Offline


Posts: 41
Joined: Dec 30th, 2015
Re: Blynk, ESP8266 NodeMCU use with Visual Micro
Reply #30 - Nov 27th, 2017 at 10:28pm
Print Post  
Other than the Blynk connect and welcome messages, there is no Serial printing coming from the straight Arduino IDE.  I used exactly the same, unchanged .ino file which I have been using with Visual Studio and Visual Micro.

The Blynk people say that Blynk uses the Serial print functions internally.  My code has a required line,
Code (C++)
Select All
#define BLYNK_PRINT Serial 

which just tells Blynk to use the Serial output mechanism.  Otherwise, they claim that their stuff could not be causing the problem.
  
Back to top
 
IP Logged
 
arduinoUser2
Junior Member
**
Offline


Posts: 41
Joined: Dec 30th, 2015
Re: Blynk, ESP8266 NodeMCU use with Visual Micro
Reply #31 - Dec 1st, 2017 at 1:53pm
Print Post  
Tim,

Has your investigation uncovered anything?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Blynk, ESP8266 NodeMCU use with Visual Micro
Reply #32 - Dec 1st, 2017 at 9:06pm
Print Post  
Hi,

Sorry I have been tied up and hope to look at it during the next week or two.

If you are unable to build in the meantime you can enable file>preferences>external editor in the arduino ide. It makes it easy to edit in VS but build/upload via the arduino ide
  
Back to top
WWW  
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Blynk, ESP8266 NodeMCU use with Visual Micro
Reply #33 - Dec 23rd, 2017 at 3:45pm
Print Post  
I tried the Blynk example and it's working okay for me. It works both with and without debug enabled.

I was testing with a huzza that has less pins. I found the board would crash a lot if I attempted to set the pinMode for invalid pins. The board is obviously sensitive to using pinMode on pins that do not exist. It might be unrelated but I suggest that you do not use pinMode on pins you are not using. 

I was only testing so i hard coded leftDoorOpen = true and commented the pinModes.Otherwise test was same as your but without the your debug #define.


Code
Select All
// Set GPIO pin modes
	//pinMode(Unused10, INPUT_PULLUP);
	//pinMode(Unused09, INPUT_PULLUP);

	//pinMode(Unused16, INPUT);
	//pinMode(leftDoorInput, INPUT_PULLUP);
	//pinMode(rightDoorInput, INPUT_PULLUP);
	//pinMode(Unused00, INPUT);
	//pinMode(Unused02, INPUT);
	//pinMode(backDoorInput, INPUT_PULLUP);
	//pinMode(Unused12, INPUT_PULLUP);
	//pinMode(Unused13, INPUT_PULLUP);
	//pinMode(Unused15, INPUT_PULLUP);
	//pinMode(Unused03, INPUT_PULLUP);
	//pinMode(Unused01, INPUT_PULLUP); 

« Last Edit: Jan 28th, 2018 at 2:28am by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
arduinoUser2
Junior Member
**
Offline


Posts: 41
Joined: Dec 30th, 2015
Re: Blynk, ESP8266 NodeMCU use with Visual Micro
Reply #34 - Jan 6th, 2018 at 11:16pm
Print Post  
Tim,

Sorry for my late reply.

All the pins in my code exist.  I used the pinMode function to set pins on the NodeMCU that I am not using in my project since it sets the states of those pins to a definite logic level.  I did not want those pins floating.  If I do not use this method, I would have to add a lot of hardware to the project to set those pins at HIGH or LOW.

I will try the debug mode again in Visual Micro and let you know what happens.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 
Send TopicPrint