Using NodeMCU 1.0 (ESP12 Module). Connecting via Wifi. I want to control pan and tilt of device with two SG90 Servo motors. Have tried Blynk Slider(2), StepH and StepV widgets all of which only allow me to select GPO pins. I have tired repeatedly but cannot change to Virtual pins. All code examples are for virtual pins. I am currently using StepV (GPO13) and StepH (GPO15) widgets. The two BLYNK_WRITE functions in my code are never accessed when the sketch is running. Step switch changes have no effect on my servos. HELP!
Thanks for Replys…
I am using both a StepH and StepV widget
That is correct…it would not let me switch to Virtual. I also tried to use sliders and I could not select Virtual on them either.
I had selected esp8266 as the device type for my project but discovered earlier this evening there is a NodeMCU type so I switched project to that type. Now I can select virtual for the step buttons but have new set of issue I haven’t been able to puzzle out. The Step buttons only return + or - the step value. I set the step button counters to 90 by code and created a variable to keep track of the change in value from that number based on step changes from virtual buttons.
Problem is servo.write( val) will not write to servo when a named variable is used for the value. I have tried type int and float for the named variable but neither works. Any thoughts there? I have a revise sketch but don’t know if including it in a reply is appropriate.
You were right… had a box set YES for send step. Now is it sending widget value
I am using Servo.h
Have a bit of code to rework… mostly delete …lol… but too tired to do it now …seems like I forgot to go to bed and here it is 4:17 AM. Oh well, I’m retired and don’t live by the clock an calendar any more.
Final Status Update. Revised the code getting rid of all the superfluous junk I had added because of stupidly chosen “send step” settings on StepH and StepV widgets and all is working as I wanted. The sketch now is short, simple and available to anyone interested in working with multiple servo motors and Blynk.
It turns out the servo.write(val) command only accepts an int variable for param.asInt(), param.asInt() itself or a number. Inserting some other variable for val in any part of the sketch code caused all servo.write() calls to be ignored.
LOL… I’ll give it some thought. What I’m working on now is my third iteration of the 3 wheeled two motor robo car thing. I’ve done it with programmed movement only, with RF Joystick Control using UNO’s and now with NodeMCU and Blynk. I discover there was a companion motor controller that the old NodeMCU plugs into that can control 2 DC motors and 4 servos with a foot print smaller than an UNO and a ton fewer wires. Since I’ve got all that servo space I decided to put a pan tilt camera and some kind of audio messaging on it so I can send it about the house to find my wife and when it does tell her to bring me a cup of coffee and a cookie. Now that is a useful IoT ! (you don’t suppose the community minds if we turn this post into a chat room do you?)