PLUGIN development - Skeleton to use as master?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
tozett
Normal user
Posts: 734
Joined: 22 Dec 2015, 15:46
Location: Germany

PLUGIN development - Skeleton to use as master?

#1 Post by tozett » 24 Aug 2016, 17:29

hi,

can you provide a (commented) Master-Sketch for Plugins?

i am far from beeing a developer, but wanted to try to get my max7219 led-matrix running under ESP-easy.
i tried a sketch besides espeasy with an adafruit lib for the may7219 and it works succesful.
Now i looked up the sketches in the playground, hoping to find an (function) empty master-sketch to put my codefragments in and test it.

maybe a dev can provide something like this?

i would be glad and could try a plugin myself.... :oops:

as i looked through the playground, i wanted to prevent deleting something out of the working examples,
as they all seem indivually 'specific' in some ways... 8-)

User avatar
bertrand
Normal user
Posts: 24
Joined: 30 Jun 2016, 10:22
Location: Hong Kong

Re: PLUGIN development - Skeleton to use as master?

#2 Post by bertrand » 14 Nov 2016, 15:26

That is a great idea !!! Instead of modifying one that wasn't meant to be used like that.

tozett
Normal user
Posts: 734
Joined: 22 Dec 2015, 15:46
Location: Germany

Re: PLUGIN development - Skeleton to use as master?

#3 Post by tozett » 14 Nov 2016, 20:10

thanks for +1
:D

musti
Normal user
Posts: 10
Joined: 20 Nov 2016, 20:54

Re: PLUGIN development - Skeleton to use as master?

#4 Post by musti » 21 Nov 2016, 21:39

+1, would be helpful

r_255
Normal user
Posts: 32
Joined: 20 Nov 2015, 20:42

Re: PLUGIN development - Skeleton to use as master?

#5 Post by r_255 » 22 Nov 2016, 03:03

+1

pbertra
Normal user
Posts: 8
Joined: 30 May 2016, 12:19

Re: PLUGIN development - Skeleton to use as master?

#6 Post by pbertra » 22 Nov 2016, 09:26

I'd really like it too: I would develop an US-100 sensor plugin

gerardovf
Normal user
Posts: 2
Joined: 18 Sep 2016, 18:26

Re: PLUGIN development - Skeleton to use as master?

#7 Post by gerardovf » 22 Nov 2016, 15:22

Yes, please! I need a plugin to control my blinds. I read two buttons (to rise/lower the blind locally). I then operate one of two relays to move the blind motor accordingly. I have created rules so that only one relay is activated at a time (I can send commands either locally or using MQTT).
I then use a HC-SR04 ultrasonic sensor to get feedback with the current blind position.
I have found that the HC-SR04 is missing many measurements when using rules, so right now I am forced to use two ElectroDragons to test the concept properly until I get a dedicated blind plugin.

Here are the rules:
On BTN_UP#SWITCH=1 do
if [BTN_DWN#SWITCH]=1
GPIO,13,0
else
if [RLY_DWN#SWITCH]=1
GPIO,13,0
else
GPIO,12,1
timerSet,1,20 //Set Timer 1 for the next event in 20 seconds
endif
endif
endon
On BTN_UP#SWITCH=0 do
GPIO,13,0
GPIO,12,0
endon
On BTN_DWN#SWITCH=1 do
if [BTN_UP#SWITCH]=1
GPIO,12,0
else
if [RLY_UP#SWITCH]=1
GPIO,12,0
else
GPIO,13,1
timerSet,1,20 //Set Timer 1 for the next event in 20 seconds
endif
endif
endon
On BTN_DWN#SWITCH=0 do
GPIO,13,0
GPIO,12,0
endon
On Rules#Timer=1 do //When Timer1 expires, do
GPIO,13,0
GPIO,12,0
endon
On STOP#SWITCH=1 do
GPIO,13,0
GPIO,12,0
endon
Attachments
IMG_20161118_102838.jpg
IMG_20161118_102838.jpg (165.01 KiB) Viewed 4304 times
IMG_20161119_104654.jpg
IMG_20161119_104654.jpg (215.39 KiB) Viewed 4304 times

jgrad
Normal user
Posts: 15
Joined: 29 Aug 2016, 22:03

Re: PLUGIN development - Skeleton to use as master?

#8 Post by jgrad » 29 Nov 2016, 22:27

gerardovf wrote:Yes, please! I need a plugin to control my blinds. I read two buttons (to rise/lower the blind locally). I then operate one of two relays to move the blind motor accordingly. I have created rules so that only one relay is activated at a time (I can send commands either locally or using MQTT).
I then use a HC-SR04 ultrasonic sensor to get feedback with the current blind position.
I have found that the HC-SR04 is missing many measurements when using rules, so right now I am forced to use two ElectroDragons to test the concept properly until I get a dedicated blind plugin.

Here are the rules:
On BTN_UP#SWITCH=1 do
if [BTN_DWN#SWITCH]=1
GPIO,13,0
else
if [RLY_DWN#SWITCH]=1
GPIO,13,0
else
GPIO,12,1
timerSet,1,20 //Set Timer 1 for the next event in 20 seconds
endif
endif
endon
On BTN_UP#SWITCH=0 do
GPIO,13,0
GPIO,12,0
endon
On BTN_DWN#SWITCH=1 do
if [BTN_UP#SWITCH]=1
GPIO,12,0
else
if [RLY_UP#SWITCH]=1
GPIO,12,0
else
GPIO,13,1
timerSet,1,20 //Set Timer 1 for the next event in 20 seconds
endif
endif
endon
On BTN_DWN#SWITCH=0 do
GPIO,13,0
GPIO,12,0
endon
On Rules#Timer=1 do //When Timer1 expires, do
GPIO,13,0
GPIO,12,0
endon
On STOP#SWITCH=1 do
GPIO,13,0
GPIO,12,0
endon
gerardovf - why do you need ultrasonic sensor for controlling blinds? Normally driver/motor for blinds/shutters have adjustable end switches.
And be careful with electrodragon devices - I use them as controllers for blinds as well and one of them become burnt because of inappropriate design - complete current for load goes through 10ohm resistor which is on PCB. This design problem is already solved by new versions of electrodragon devices.
ED_burnt.jpg
ED_burnt.jpg (159.43 KiB) Viewed 4228 times

gerardovf
Normal user
Posts: 2
Joined: 18 Sep 2016, 18:26

Re: PLUGIN development - Skeleton to use as master?

#9 Post by gerardovf » 18 Jan 2017, 23:08

Hi jgrad!
The reason to use an element to get the distance is:
- Get feedback to see if the command was executed. I use it too to get the position of my garage door as a double check (I use also a reed switch to get the closed position).
- Use distance as a goal. E.g. I can tell the blind to go up/down to a certain position.
I first tried to use rules just to execute the blind logic (with no measure value involved) but they were slow and sometimes both relays were activated at the same time.

This is how I have implemented it. I modified device _013 (now _129) and the measurements are executed 10 times per second. I use 5 readings to calculate the median value (I had erratic values from time to time). The new 'blind' device (_130) uses 4 GPIOs to read up/down buttons and to control up/down relays; it is also able to get the readings from device _129 to decide when to stop.

I am not able to attach the two plugin files (_P130_BLINDCTRL.ino and _P130_BLINDCTRL.ino) here. I even tried to rename them to .txt with no success.

Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests