Digital read and digital write arduino digital pin

without using Blynk nor the hc 05 module , my arduino executed what I planned , I.e output of a comparator 4.8v DC was fed to digital pin 12 and if it’s high , digital pin 13 was written high and led connected to 13 was turned on . simple !

but I next planned to use blynk !
board : Arduino uno
shield : hc05 Bluetooth module
I just copy pasted my conventional code and pasted into the required syntax meant for blynk .
you could see that code inside mytimer event .
what happened is arduino never permitted pin13 to go high ! practically nothing is happening as it happened before ! no led turning ON .

when I connected hc05 on blynk app , serial monitor began to show “packet too big” !

plz be kind enough ! I had a lot of expectation on this blynk app for my project and I failed miserably and let my friends down !

int led=13;
int inpin=12;
int val=0;

#define BLYNK_PRINT Serial
#include <SoftwareSerial.h>
SoftwareSerial SwSerial(10, 11); // RX, TX
    
#include <BlynkSimpleSerialBLE.h>
#include <SoftwareSerial.h>

char auth[] = "YourAuthToken";

SoftwareSerial SerialBLE(10, 11); // RX, TX

BlynkTimer timer;

void myTimerEvent()
{
  val=digitalRead(inpin);
  digitalWrite(led,val);
  Blynk.virtualWrite(V1, "LED ON");
}

void setup()
{

  Serial.begin(9600);

  SerialBLE.begin(9600);
  Blynk.begin(SerialBLE, auth);

  Serial.println("Waiting for connections...");
  timer.setInterval(1000L, myTimerEvent);
   pinMode(led,OUTPUT);
   pinMode(inpin,INPUT);
}

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

Your pin mode commands should come first in the setup() as should anything you want to start working prior to the Blynk connection… perhaps like your timer?

1 Like

I thought arduino really didn’t bother about position of commands . :grin: … my bad !

see , I had a notion that mytimer event is only meant for sensor kind of applications , but will this "digital pin read and write " could also work under this timer event right? as long as digital pin input remains high for 2 or 3 seconds …

as long as digital pin input remains high for 2 or 3 seconds

that’s right :wink:

1 Like

what about the " packet too big " stuff and reconnecting issues …

Will the beta + 0.6v library help ??

sir , after I turned on my blynk app and switched bluetooth ON , hc 05 starts to blink once or twice only after every 5 seconds . that means it’s good to go right ?? but I’m receiving "packet too big 15400 " some kind of junk value ! what’s up with that ??

Have you tried searching the forum for the “Packet too big” error?

Pete.

yup ! though I never got a clear view on it . I think I heard blynk beta might solve these kind of issues to some extend.

sir , thanks a lot for your help . as of now , my arduino digital reads the digital pin 12 for instance and sends the data to Lcd widget . if input is high , widget displays 1 , and 0 when input is shorted ! At the same time , writes digital pin 13 and Lights up the LED connected to it if input is high .

I was just wondering if there was option to have access to log of all these data displayed on the lcd widget ? LCD might display certain values at different times . some kind of cloud access for the report ?? There’s a “send report” option in super chart . likewise anything for LCD??

Have you tried the ‘Report’ widget?

You can select which virtual pins you would like to see data for.

I’ve seen report widget . but it says it won’t work with Bluetooth module i have (yet) … but im able to drop with widget …

any clues on webhook ??

I’ve never used Bluetooth, so don’t know which widgets work and which don’t.
You could try the terminal widget or the table widget. Both give you some history.

I don’t think Webhook will work with Bluetooth.

Wouldn’t you be better with a NodeMCU and Wi-Fi connection instead?

Pete.

1 Like

terminal widget provides log of data displayed in other widgets like LCD ??

I don t really understand the question, but the terminal widget is similar to the serial monitor of the PC - you can scroll back and see previous lines of data.
The Table widget is probably a better option though.

Pete.

1 Like

so instead of using a LCD widget , the data that I meant to send to app , whether it be a string or a number , could be displayed on a table widget ?? each row …

Sorry I overlooked that fact that you said you were using Bluetooth.

I think the terminal widget displays the last 25 messages in the buffer but I am also not sure whether it would work with a Bluetooth device.

1 Like

what about the table widget sir ?

pin 12 high -> " over voltage " string
pin 11 high -> " under voltage "

that kinda motive :grin: .
to have a log , over voltage happened 21:57 - 1

I don’t really understand your questions, and as I’ve never used Bluetooth I can’t really give solid answers anyway.

What I’m trying to do is to point you in a variety of possible directions that may provide what you’re looking for. It’s up to you to read the documentation for each widget - which is here:

and do some experimentation of your own to find a solution that works for you, with your particular connection type and mobile O/S.

Pete.

1 Like

NO. The terminal widget is just another type of display. The App itself doesn’t really have any data “logging” aside from the SuperChart (which requires other widgets to be displaying the data first) & Reporting Widget (which is replacing the CSV export from withing the SuperChart), and yes, perhaps the Table Widget is a form of data storage… But again, that all requires a full Server link (not currently available with BT/BLE) as it is the Server that actually stores the data.