PLUGIN development - Skeleton to use as master?
Moderators: grovkillen, Stuntteam, TD-er
PLUGIN development - Skeleton to use as master?
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....
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...
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....
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...
Re: PLUGIN development - Skeleton to use as master?
That is a great idea !!! Instead of modifying one that wasn't meant to be used like that.
Re: PLUGIN development - Skeleton to use as master?
thanks for +1
Re: PLUGIN development - Skeleton to use as master?
+1, would be helpful
Re: PLUGIN development - Skeleton to use as master?
I'd really like it too: I would develop an US-100 sensor plugin
Re: PLUGIN development - Skeleton to use as master?
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
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 (165.01 KiB) Viewed 8375 times
-
- IMG_20161119_104654.jpg (215.39 KiB) Viewed 8375 times
Re: PLUGIN development - Skeleton to use as master?
gerardovf - why do you need ultrasonic sensor for controlling blinds? Normally driver/motor for blinds/shutters have adjustable end switches.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
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.
Re: PLUGIN development - Skeleton to use as master?
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.
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.
Who is online
Users browsing this forum: Ahrefs [Bot] and 31 guests