This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Electric Imp code example - AC dimmer | |
// Define zero crossing period = 1 / Mains Freq / 2 | |
// 60Hz = 0.008333, 50Hz = 0.01 | |
const ZEROT = 0.008333; | |
local pinZerox = hardware.pin9; // Pin to use as zero cross input | |
local pinTriac = hardware.pin2; // Pin to use for triac control | |
local level = 0.5; // Dimmer level 0.0 = Off, 1.0 = Full bright | |
local tic=0; |