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

I am writing a code for bridge communication

I need to convert 0 to 1023 analog signals to 1000 to 2000 microseconds digital signals from receiver side

Use map function :stuck_out_tongue_winking_eye:

https://www.arduino.cc/reference/en/language/functions/math/map/

2 Likes

I used it :yum:

1 Like

I want to make a voltage divider Can I use IN4007 diodes for that

You need two resistors to make a voltage divider!

Pete.

2 Likes

what resistors do I need sir

Depends on the input voltage

1 Like

the input voltage is 5 volts and i need 3.3 volts

Google is your friend!

Pete.

2 Likes

330k and 220k

1 Like

I searched for it but every page had different answers :worried:

thanks sir :smiley:

1 Like

2021-06-22_173705

R1=220K
R2=330K

1 Like

thanks

1 Like

That’s because there are numerous combinations of suitable resistor values, and it depends on whether you are using the voltage divider to change a digital (logic level) signal from 5v to 3.3v (which isn’t usually necessary) or changing an analog output so that it is suitable for use with an ESP8266 or ESP32 (which both have different analog input voltage requirements).

Pete.

3 Likes

I use that because I have these resistors in stock :stuck_out_tongue_winking_eye:
The output is 3v but that’s works fine

1 Like

can i use 330ohm and 220ohm resistors

That’s works too

1 Like

Thank god cuz i do not have 330kohm and 220kohm resistors

1 Like
#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(1000L, 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);

  bridge2.virtualWrite(V1, A36);
  bridge2.virtualWrite(V2, A39);
  bridge2.virtualWrite(V3, A34);
  bridge2.virtualWrite(V4, A35);
  bridge2.virtualWrite(V5, A32);
  bridge2.virtualWrite(V6, A33);
}

BLYNK_CONNECTED() {
  bridge2.setAuthToken("BridgeAuth2"); 

sir will this code transmit data to every virtual pin in the code or just virtual pin 2