Commit f254c10b437a4a4a118a52b24cdbc288d935c026
Committed by
GitHub
1 parent
d8f5eee7
Delete Dimmer.ino
Showing
1 changed file
with
0 additions
and
64 deletions
Examples/Dimmer/Dimmer.ino deleted
| 1 | -/*########################################################################### | |
| 2 | -DALI Interface Demo | |
| 3 | - | |
| 4 | -Dimms all lights connected to the DALI bus up and down | |
| 5 | - | |
| 6 | -Works with Arduino ATMEGA328 + Mikroe DALI Click | |
| 7 | - | |
| 8 | ----------------------------------------------------------------------------- | |
| 9 | -Changelog: | |
| 10 | -2020-11-08 Created & tested on ATMega328 @ 8Mhz | |
| 11 | ----------------------------------------------------------------------------- | |
| 12 | - Dimmer.ino - copyright qqqlab.com / github.com/qqqlab | |
| 13 | - | |
| 14 | - This program is free software: you can redistribute it and/or modify | |
| 15 | - it under the terms of the GNU General Public License as published by | |
| 16 | - the Free Software Foundation, either version 3 of the License, or | |
| 17 | - (at your option) any later version. | |
| 18 | - | |
| 19 | - This program is distributed in the hope that it will be useful, | |
| 20 | - but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 21 | - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 22 | - GNU General Public License for more details. | |
| 23 | - | |
| 24 | - You should have received a copy of the GNU General Public License | |
| 25 | - along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 26 | -###########################################################################*/ | |
| 27 | - | |
| 28 | -#define DALI_OUTPUT_PIN 3 | |
| 29 | -#define DALI_INPUT_PIN 4 | |
| 30 | - | |
| 31 | -#include "qqqDali_ATMega328.h" | |
| 32 | - | |
| 33 | -Dali_ATMega328 dali; | |
| 34 | - | |
| 35 | -void setup() { | |
| 36 | - Serial.begin(115200); | |
| 37 | - Serial.println("DALI Dimmer Demo"); | |
| 38 | - | |
| 39 | - //start the DALI interfaces | |
| 40 | - //arguments: tx_pin, rx_pin (negative values disable transmitter / receiver) | |
| 41 | - //Note: the receiver pins should be on different PCINT groups, e.g one | |
| 42 | - //receiver on pin0-7 (PCINT2) one on pin8-13 (PCINT0) and one on pin14-19 (PCINT1) | |
| 43 | - dali.begin(DALI_OUTPUT_PIN, DALI_INPUT_PIN); | |
| 44 | -} | |
| 45 | - | |
| 46 | -#define MIN_LEVEL 100 //most LED Drivers do not get much lower than this | |
| 47 | -int16_t level = 254; //254 is max level, 1 is min level (if driver supports it), 0 is off | |
| 48 | -int8_t level_step = 4; | |
| 49 | - | |
| 50 | -void loop() { | |
| 51 | - Serial.print("set level: "); | |
| 52 | - Serial.println(level); | |
| 53 | - dali.set_level(level); | |
| 54 | - | |
| 55 | - level+=level_step; | |
| 56 | - if(level>=254) { | |
| 57 | - level = 254; | |
| 58 | - level_step = -level_step; | |
| 59 | - } | |
| 60 | - if(level<MIN_LEVEL) { | |
| 61 | - level = MIN_LEVEL; | |
| 62 | - level_step = -level_step; | |
| 63 | - } | |
| 64 | -} |