i does it writes the values from transmitter on the pins mentioned below
Donât write bridge in the receiver code
but
BLYNK_WRITE(V1) {
A36= param.asInt();
}
All that this doesâŚ
is to take the value sent on pin V1 and assign it to a local variable called pindata1
Because pindata1
is local, itâs not visible outside the BLYNK_WRITE(V1)
, and you donât have any code - either inside or outside of the BLYNK_WRITE(V1)
function - to do anything with that variable.
So, it doesnât do anything.
Pete.
so how do I fix this sir?
Presumably by taking the incoming pindata1
, re-mapping it, and writing the re-mapped value to your servo.
I think that personally, Iâd do the re-mapping before itâs sent from the transmitting device.
Iâd also get rid of these silly aa bb cc dd....
local variables in your void setup - they donât achieve anything either.
Pete.
ok sir i will do it thanx
sir can I write the values of pindata1
to my object here
When you say âyour objectâ do you mean your servo?
If so then yes.
Pete.
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <Servo.h>
Servo servo1;
Servo servo2;
Servo servo3;
Servo servo4;
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "ljF4YLcyFN9P6iVeze92GsffvGwSeb2J";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "nitinpa";
char pass[] = "nitinpa1";
BLYNK_WRITE(V1){
int pindata1 = param.asInt();
servo1.write(pindata1);
}
BLYNK_WRITE(V2){
int pindata2 = param.asInt();
servo2.write(pindata2);
}
BLYNK_WRITE(V3){
int pindata3 = param.asInt();
servo3.write(pindata3);
}
BLYNK_WRITE(V4){
int pindata4 = param.asInt();
servo4.write(pindata4);
}
BLYNK_WRITE(V5){
int pindata5 = param.asInt();
}
BLYNK_WRITE(V6){
int pindata6 = param.asInt();
}
void setup(){
servo1.attach(27);
servo2.attach(26);
servo3.attach(25);
servo4.attach(33);
}
void loop()
{
Blynk.run();
}
will this receiver code work sir
So you donât need to re-map the incoming data values?
Pete.
i wrote the new transmitter code i mapped the values there
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <Blynk.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "qmppE8kZmNhF8zTuaQdi__QnmIL-Dw1u";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "nitinpa";
char pass[] = "nitinpa1";
char BridgeAuth2[] = "ljF4YLcyFN9P6iVeze92GsffvGwSeb2J";
BlynkTimer timer;
WidgetBridge bridge1(V1);
WidgetBridge bridge2(V2);
void setup() {
Blynk.begin(auth, ssid, pass);
while (Blynk.connect() == false) {
}
timer.setInterval(100L, Reading);
}
void loop()
{
Blynk.run();
timer.run();
}
void Reading(){
int A36 = analogRead(36);
int A39 = analogRead(39);
int A34 = analogRead(34);
int A35 = analogRead(35);
int A32 = digitalRead(32);
int A33 = digitalRead(33);
int mapped0 = map(A36, 0, 255, 1000, 2000);
int mapped1 = map(A39, 0, 255, 1000, 2000);
int mapped2 = map(A34, 0, 255, 1000, 2000);
int mapped3 = map(A35, 0, 255, 1000, 2000);
bridge2.virtualWrite(V1, mapped0);
bridge2.virtualWrite(V2, mapped1);
bridge2.virtualWrite(V3, mapped2);
bridge2.virtualWrite(V4, mapped3);
bridge2.virtualWrite(V5, A32);
bridge2.virtualWrite(V6, A33);
}
BLYNK_CONNECTED() {
bridge2.setAuthToken("BridgeAuth2"); // Token of the hardware B
}
will this transmitter code work sir