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
var mqtt = require('mqtt'); //https://www.npmjs.com/package/mqtt | |
var Topic = '#'; //subscribe to all topics | |
var Broker_URL = 'mqtt://192.168.1.123'; | |
var Database_URL = '192.168.1.123'; | |
var options = { | |
clientId: 'MyMQTT', | |
port: 1883, | |
//username: 'mqtt_user', | |
//password: 'mqtt_password', |
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
var mqtt = require('mqtt'); | |
var Topic = '#'; //subscribe to all topics | |
var Broker_URL = 'mqtt://192.168.1.123'; | |
var Database_URL = '192.168.1.123'; | |
var options = { | |
clientId: 'MyMQTT', | |
port: 1883, | |
//username: 'mqtt_user', | |
//password: 'mqtt_password', |
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
var mqtt = require('mqtt'); | |
var Topic = '#'; //subscribe to all topics | |
var Broker_URL = 'mqtt://192.168.1.123'; | |
var options = { | |
clientId: 'MyMQTT', | |
port: 1883, | |
keepalive : 60 | |
}; |
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
var mysql = require('mysql'); | |
//Create Connection | |
var connection = mysql.createConnection({ | |
host: "192.168.1.123", | |
user: "newuser", | |
password: "mypassword", | |
database: "mydb" | |
}); |
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
/* | |
Arduino sketch: Split comma or any other character delimited string into an array | |
by SM Ching (http://ediy.com.my) | |
*/ | |
#define MAX_WORLD_COUNT 5 | |
#define MIN_WORLD_COUNT 2 | |
char *Words[MAX_WORLD_COUNT]; | |
char *StringToParse; |
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
#include <EEPROM.h> | |
// Absolute min and max eeprom addresses. Actual values are hardware-dependent. | |
// These values can be changed e.g. to protect eeprom cells outside this range. | |
const int EEPROM_MIN_ADDR = 0; | |
const int EEPROM_MAX_ADDR = 511; | |
// Returns true if the address is between the | |
// minimum and maximum allowed values, false otherwise. | |
// | |
// This function is used by the other, higher-level functions |
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
/* | |
Basic Pin setup: | |
------------ ---u---- | |
ARDUINO 13|-> SCLK (pin 25) OUT1 |1 28| OUT channel 0 | |
12| OUT2 |2 27|-> GND (VPRG) | |
11|-> SIN (pin 26) OUT3 |3 26|-> SIN (pin 11) | |
10|-> BLANK (pin 23) OUT4 |4 25|-> SCLK (pin 13) | |
9|-> XLAT (pin 24) . |5 24|-> XLAT (pin 9) | |
8| . |6 23|-> BLANK (pin 10) | |
7| . |7 22|-> GND |
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
/* | |
16 Channels Lighting Controller | |
By smching (ediy.com.my) | |
Allow Arduino Mega to communicate with Vixen via generic serial plugin | |
*/ | |
#define CHANNELS_COUNT 16 | |
////////// PWM pin | |
#define Ch1 2 // PWM Pin 2 | |
#define Ch2 3 // PWM Pin 3 | |
#define Ch3 4 // PWM Pin 4 |
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
boolean isTimeout() { | |
runEventAnyTime(); | |
if (millis() >= previousMillis + KEYBOARD_EVENT_TIMEOUT *1000){ //convert KEYBOARD_EVENT_TIMEOUT in milli second to second | |
playTimeOutTone(); | |
return true; | |
} else return false; | |
} |
NewerOlder