forked from sabhiram/raspberry-wifi-conf
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample.js
36 lines (33 loc) · 997 Bytes
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const exec = require('child_process').execSync;
const wifiConf = require('./app/app');
var value = 0;
const blinkInterval = setInterval(() => {
value = value ? 0 : 1;
exec(`echo ${value} >/sys/class/leds/led0/brightness`);
}, 220);
config = {
"wifi_interface": "wlan0",
"wifi_driver_type": "nl80211",
"access_point": {
"force_reconfigure": true,
"wifi_interface": "wlan0",
"ssid": "rpi-config-ap",
"passphrase": "zzzzzzzz",
"domain": "rpi.config",
"ip_addr": "192.168.44.1",
"netmask": "255.255.255.0",
"subnet_ip": "192.168.44.0",
"broadcast_address": "192.168.44.255",
"subnet_range": {
"start": "192.168.44.10",
"end": "192.168.44.50"
}
},
"server": {
"port": 88
}
};
wifiConf(config, (error) => {
console.log(error);
clearInterval(blinkInterval);
});