Halaman

Rabu, 13 September 2017

voltage monitor pakai arduino dan seven segment

Bikin voltage monitor pakai arduino ama seven segment meski cuma ampe 5 volt doang...(ngapain coba mahal2 bikin pake ini??) Maklum justru lagi ada yang nganggur kagak kudu beli sepeser pun.


kodenya nih.

/*
Read me

Use all this information at your own risk, i hold no responsibility for any and all indirect or dicrect damage to your arduino, hardware and software of your pc, any electronic devices if you choose to use this information.

This meter only can measure up to 5V

This meter cannot measure negative voltage and make sure you connect the probes to the battery in the correct way (red probe(A0) to the positive side of the battery and black probe(GND) to the negative side of the battery)

*/
int a=13;
int b=12;
int c=11;
int d=10;
int e=9;
int f=8;
int g=7;
int deci = 3;
int gnd1=6;
int gnd2=5;
int gnd3=4;
int inp=A0;

float Reading;
int OneDigit, TenDigit, HundredDigit;

void mask(int num, int aa, int bb, int cc, int dd, int ee, int ff, int gg) 

switch (num) 

case 0 :
digitalWrite(aa, HIGH);
digitalWrite(bb, HIGH);
digitalWrite(cc, HIGH);
digitalWrite(dd, HIGH);
digitalWrite(ee, HIGH);
digitalWrite(ff, HIGH);
digitalWrite(gg, LOW);
break;

case 1 : 
digitalWrite(aa, LOW);
digitalWrite(bb, HIGH);
digitalWrite(cc, HIGH);
digitalWrite(dd, LOW);
digitalWrite(ee, LOW);
digitalWrite(ff, LOW);
digitalWrite(gg, LOW);
break;

case 2 : 
digitalWrite(aa, HIGH);
digitalWrite(bb, HIGH);
digitalWrite(cc, LOW);
digitalWrite(dd, HIGH);
digitalWrite(ee, HIGH);
digitalWrite(ff, LOW);
digitalWrite(gg, HIGH);
break;

case 3 : 
digitalWrite(aa, HIGH);
digitalWrite(bb, HIGH);
digitalWrite(cc, HIGH);
digitalWrite(dd, HIGH);
digitalWrite(ee, LOW);
digitalWrite(ff, LOW);
digitalWrite(gg, HIGH);
break;

case 4 : 
digitalWrite(aa, LOW);
digitalWrite(bb, HIGH);
digitalWrite(cc, HIGH);
digitalWrite(dd, LOW);
digitalWrite(ee, LOW);
digitalWrite(ff, HIGH);
digitalWrite(gg, HIGH);
break;

case 5 : 
digitalWrite(aa, HIGH);
digitalWrite(bb, LOW);
digitalWrite(cc, HIGH);
digitalWrite(dd, HIGH);
digitalWrite(ee, LOW);
digitalWrite(ff, HIGH);
digitalWrite(gg, HIGH);
break;

case 6 : 
digitalWrite(aa, HIGH);
digitalWrite(bb, LOW);
digitalWrite(cc, HIGH);
digitalWrite(dd, HIGH);
digitalWrite(ee, HIGH);
digitalWrite(ff, HIGH);
digitalWrite(gg, HIGH);
break;

case 7 : 
digitalWrite(aa, HIGH);
digitalWrite(bb, HIGH);
digitalWrite(cc, HIGH);
digitalWrite(dd, LOW);
digitalWrite(ee, LOW);
digitalWrite(ff, LOW);
digitalWrite(gg, LOW);
break;

case 8 : 
digitalWrite(aa, HIGH);
digitalWrite(bb, HIGH);
digitalWrite(cc, HIGH);
digitalWrite(dd, HIGH);
digitalWrite(ee, HIGH);
digitalWrite(ff, HIGH);
digitalWrite(gg, HIGH);
break;

case 9 : 
digitalWrite(aa, HIGH);
digitalWrite(bb, HIGH);
digitalWrite(cc, HIGH);
digitalWrite(dd, HIGH);
digitalWrite(ee, LOW);
digitalWrite(ff, HIGH);
digitalWrite(gg, HIGH);
break;

}
}

void setup()
{
 pinMode(a,OUTPUT);
 pinMode(b,OUTPUT);
 pinMode(c,OUTPUT);
 pinMode(d,OUTPUT);
 pinMode(e,OUTPUT);
 pinMode(f,OUTPUT);
 pinMode(g,OUTPUT);
 pinMode(deci,OUTPUT); 
 pinMode(gnd1,OUTPUT);
 pinMode(gnd2, OUTPUT);
 pinMode(gnd3, OUTPUT);
 pinMode(inp, INPUT); 
 digitalWrite(deci, HIGH);
}

void loop ()
{
  float TempOneDigit;
  int i;
Reading = (analogRead(inp)*5.00/1023.00);
HundredDigit = int(Reading) % 10;
TenDigit = int ((Reading-HundredDigit )*10) % 10;
TempOneDigit = int(Reading * 10);
OneDigit = int ((Reading - float(TempOneDigit/10))* 100) %10;

for (i=0 ; i<20 ; i++) {
mask (OneDigit, a, b, c, d, e, f, g);
digitalWrite(gnd3,LOW);
digitalWrite(gnd2, HIGH);
digitalWrite(gnd1, HIGH);
delay(5);
mask (TenDigit, a, b, c, d, e, f ,g);
digitalWrite(gnd3,HIGH);
digitalWrite(gnd2, LOW);
digitalWrite(gnd1, HIGH);
delay(5);
mask (HundredDigit, a, b, c, d, e, f ,g);
digitalWrite(gnd3,HIGH);
digitalWrite(gnd2, HIGH);
digitalWrite(gnd1, LOW);
delay(5);

}

}

##sumber http://forum.arduino.cc/index.php?topic=233532.msg1681606#msg1681606



Senin, 04 September 2017

OpenWrt: opkg update gak berhasil

Lagi mau update openwrt tapi opkg update selalu gagal begini

Gak taunya settingan DNS di openwrt belum diseeting #OMG

Catatan eror code
This is the list of exit codes for wget:
0 No problems occurred
1 Generic error code
2 Parse error — for instance, when parsing command-line options, the .wgetrc or .netrc…
3 File I/O error
4 Network failure
5 SSL verification failure
6 Username/password authentication failure
7 Protocol errors
8 Server issued an error response




Selasa, 25 April 2017

screen capture gif

Ini dua aplikasi screen capture gif karena gue paling seneng kalo liat tutorial diblog yang ada animasi bergeraknya, Sayangnya kalo video loadingnya lambat kalo inet lagi kenceng sih gak masalah nah kalo GIF lumayan deh agak cepet meski tanpa suara.
Contohnya kaya gini nih.



Nah dua aplikasinya kecil-kecil bro cekidot

  1. LICEcap bisa download disni http://www.cockos.com/licecap/
  2. Screentogif bisa ente download disokin http://www.screentogif.com/
Laen kali bikin tulisan nya perbanyak pake gambar yang beginian deh.

Minggu, 19 Februari 2017

Problem with "windows features on or off"

Bis install PC pake windows 8 lite. Ternyata gada paket dotnet Framework 3.5 nya.
Akhirnya install manual pake installer dotnetfx35.exe nya microsoft.
Ternata eh ternyata, ERROR!!!!!!!!!!!


dan...... hujan pun turun, perut laper,,,, makan dulu

---------------------------------------------------------------------------------------------------------
solusinya :


  1. buka command prompt (Admin)
  2. ketik "sfc /scannow"
  3. Dan ketik perintah ini untuk memperbaiki "DISM /Online /Cleanup-Image /RestoreHealth"
  4. tunggu sampe selesai....
Lanjutin makan nya....



Rabu, 18 Januari 2017

Install Rocket.Chat Server with Nginx on Ubuntu 16.04

Step 1 - Install the Rocket.Chat Dependencies

Log in to the server using ssh (or the terminal) and type 'sudo su' to gain root access:
ssh vagrant@192.168.1.110
sudo su
Update the Ubuntu repository:
apt-get update
Next, install new packages needed by Rocket.Chat:
apt-get install curl graphicsmagick build-essential

Step 2 - Install MongoDB

Rocket.Chat requires MongoDB for the installation. In this step, we will install MongoDB 3.2 from the MongoDB repository.
Add the MongoDB keyserver so we can access the packages:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
Then add the MongoDB repository with the command below:
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
Update the repository and install MongoDB with the apt command:
apt-get update
apt-get install mongodb-org
Add MongoDB to run at the boot time and start it:
systemctl enable mongod
systemctl start mongod
MongoDB has been started on port 27017.

Step 3 - Configure MongoDB ReplicaSet

To improve the performance, Rocket.Chat uses a MongoDB ReplicaSet. In this step, we will configure a simple MongoDB ReplicaSet by editing the MongoDB configuration file.
Edit mongod.conf file with vim:
vim /etc/mongod.conf
Add a "#" at the beginning of line 24 to disable MongoDB running on the localhost IP only.
net:
    port: 27017
    #bindIp: 127.0.0.1
Add the ReplicaSet configuration below at line 34.
#replication:                                                          
replication:                                                           
   oplogSizeMB: 1                                                      
   replSetName: rs0
Save and exit.
Restart the MongoDB service:
systemctl restart mongod
Next, start the MongoDB shell and initiate the ReplicaSet:
export LC_ALL=C
mongo
rs.initiate()
Initiate results:
{
  "info2" : "no configuration specified. Using a default configuration for the set",
  "me" : "serverku-sensei:27017",
  "ok" : 1
}
Make sure the 'ok' value is 1. If the result is another number, then this means that something is wrong.

Step 4 - Install npm and nodejs

In this step, we will install nodejs and npm from the Ubuntu repository. Then we will install the n package with the npm command to get a specific nodejs version. Latest Rocket.Chat version needs nodejs 4.5.
Install nodejs and npm from the Ubuntu repository:
apt-get install nodejs npm
Next install the n package globally to the system with the npm command:
npm install -g n
Use the n command to download and set nodejs version 4.5.
sudo n 4.5
Finally, check the nodejs version:
node --version
npm -v

Step 5 - Install Rocket.Chat Server

We will install Rocket.Chat (latest version) in the /var/www/ directory.
Download the latest version of Rocket.Chat and extract it:
curl -L https://rocket.chat/releases/latest/download -o rocket.chat.tgz
tar -xzvf rocket.chat.tgz
Create a new /var/www/ directory and rename the bundle directory to 'Rocket.Chat' and then move it:
mkdir -p /var/www/
mv bundle Rocket.Chat
mv Rocket.Chat /var/www/
Go to the Rocket.Chat directory, set some required environment variables and start the Rocket.Chat server.
cd /var/www/Rocket.Chat/
cd programs/server/
npm install

cd ../../
export ROOT_URL=http://192.168.1.110:3000/
export MONGO_URL=mongodb://serverku:27017/rocketchat?replicaSet=rs0
export PORT=3000
node main.js
Rocket.Chat is installed, open your web browser and visit the server IP address on port 3000. 
Example : http://192.168.1.110:3000.

Step 6 - Install and Configure Nginx as Reverse Proxy for Rocket.Chat

In step 5, we installed Rocket.Chat as standalone application. In this tutorial, we will run Rocket.Chat behind the Nginx web server on https connections to get a secure and fast setup.
Install Nginx with the apt command:
apt-get install nginx
Create a new SSL directory:
mkdir -p /etc/nginx/ssl/
cd /etc/nginx/ssl/
Generate the SSL certificate file and change permission of the key file:
openssl req -new -x509 -days 365 -nodes -out /etc/nginx/ssl/rocket-chat.crt -keyout /etc/nginx/ssl/rocket-chat.key
chmod 400 rocket-chat.key
Next, create a new rocket-chat virtual host file in the sites-available directory.
cd /etc/nginx/sites-available/
vim rocket-chat
Paste the new virtual host configuration below:
# Upstreams
upstream backend {
    server 127.0.0.1:3000;
}
 
# Redirect Options
server {
  listen 80;
  server_name rocket-chat.co;
  # enforce https
  return 301 https://$server_name$request_uri;
}
 
# HTTPS Server
server {
    listen 443;
    server_name rocket-chat.co;
 
    error_log /var/log/nginx/rocketchat.access.log;
 
    ssl on;
    ssl_certificate /etc/nginx/ssl/rocket-chat.crt;
    ssl_certificate_key /etc/nginx/ssl/rocket-chat.key;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # dont use SSLv3 ref: POODLE
 
    location / {
        proxy_pass http://192.168.1.110:3000/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $http_host;
 
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forward-Proto http;
        proxy_set_header X-Nginx-Proxy true;
 
        proxy_redirect off;
    }
}
Save and exit.
I will run Rocket.Chat with new domain name 'rocket-chat.co'. Please use your own domain name and replace it in the configuration files wherever it appears.
Activate the Rocket.Chat virtual host and test the configuration file:
ln -s /etc/nginx/sites-available/rocket-chat /etc/nginx/sites-enabled/rocket-chat
nginx -t
Make sure there are no error messages.
Restart the Nginx web server:
systemctl restart nginx

Step 7 - Testing Rocket.Chat

Nginx has been configured as reverse proxy for the Rocket.Chat server and we need to update the environment variables to run Rocket.Chat now.
Run Rocket.Chat with the new variables below:
cd /var/www/Rocket.Chat/
export ROOT_URL=https://rocket-chat.co
export MONGO_URL=mongodb://serverku:27017/rocketchat?replicaSet=rs0
export PORT=3000
node main.js

In your web browser, open the URL: rocket-chat.co (or your custom domain nam) - you will be redirected to the https connection.
Create your first admin account by clicking on 'Register a new account' link.

Reference