Arduino Uno+ ethernet shield
Android appver. 2.27.10
Blynk server with blink library 0.6.1
Every time I start or my arduino and blynk starts it changes my d7 and d8 pins(which is what I am wanting to use to control a relay) to high state for a second then is goes back to low. The problem is I want to use the relay for a garage door opener and by it going high my relay opens the doors. I am new to coding so I slightly modified the generic sketch. I did try this code
and I did not resolve the problem.
TLDR: Pinstate changes to high on blynk startup briefly and I need it to stay low.
#define BLYNK_PRINT Serial
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth = "*****************************";
#define W5100_CS 10
#define SDCARD_CS 4
// Debug console
digitalWrite(SDCARD_CS, HIGH); // Deselect the SD card
// You can also specify server:
//Blynk.begin(auth, "blynk-cloud.com", 80);
//Blynk.begin(auth, IPAddress(192,168,1,100), 8080);
// You can inject your own code or combine it with other sketches.
// Check other examples on how to communicate with Blynk. Remember
// to avoid delay() function!
The pinMode statement should be used to declare a pin for use as input or output, and to specify whether the pin is pulled up (HIGH) by default.
I’m surprised that the pinMode statement you’re using compiles correctly.
The standard way to overcome the issue that you’re having is to declare the pin as being an output, then immediately doing a digitalWrite to that pin.
Also, you may continue to have issues with this problem if you use direct pin manipulation in the app (assigning widgets to digital rather than virtual pins).
your web search was better than mine. I fixed it using this method. Once again not a coder but it is working. Now if I can get my ifttt working I am all set thanks to the both of you.
From what I read on the forum.arduino site by changing it to input first it prevents the pin from floating. Otherwise the only other workaround is to use a pull down resistor. I honestly don’t know but that was my understanding and it has been working.
Just a word of caution, I would suggest you put some limit switch’s and some flags in your code so you know if it is open or closed. Very important in my country. Gets to -40°C in the winter. Could even set notifications to notify you when it opens or closes. Feel free to post pics of your circuit board or PM me with it.
Update: After running some ethernet to the garage and some port forwarding SUCCESS!! Though it does blip for a fraction of a second my door openers are not sensitive enough for that to matter. They stayed closed after 10 manual resets. Thank you to you both for your time and ideas. Not sure if I need to edit title to be solved or not.