Skip to content

Instantly share code, notes, and snippets.

@klanjabrik
klanjabrik / README.MD
Last active September 21, 2023 11:31
Measuring Water Usage with NodeMCU +WaterFlow Sensor

esp layout single

PENDAHULUAN

Internet of Things yang bisa disebut dengan IoT menjadi bagian yang penting dalam kemajuan teknologi. Contohnya adalah dengan mengirimkan data penggunaan air dari sensor ke cloud sehingga bisa dengan mudah melihat hasilnya. Untuk mengirimkan data penggunaan air dari sensor ke cloud maka dibutuhkan internet. Sehingga jika berbicara tentang IoT maka kira berbicara tidak terlepas dari 2 hal, yaitu: sensor dan internet.

PERANGKAT KERAS YANG DIBUTUHKAN

  • NodeMCU Lua WiFi (Rp85.000)
  • Water Flow Sensor (Rp70.000)
  • Lampu LED (Rp350)
#ifndef Kucing_h
#define Kucing_h
namespace klanjabrik {
void takonKabar();
class Kucing {
public:
Kucing();
void bicara();
#include <iostream>
#include "Kucing.h"
namespace klanjabrik {
void takonKabar() {
std::cout << "Piye kabare, dab???" << std::endl;
}
Kucing::Kucing() {}
#include <iostream>
#include <Kucing.h>
int main() {
klanjabrik::takonKabar();
klanjabrik::Kucing jack;
jack.bicara();
return 0;
// Credit:
// - https://diyhacking.com/arduino-flow-rate-sensor
// - http://www.instructables.com/id/Flowmeter-NodeMcu-Counting-Litres/
#include <Arduino.h>
#include <EEPROM.h>
#define USE_SERIAL Serial
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
@klanjabrik
klanjabrik / merge.sh
Last active May 14, 2019 09:25
Merge multi webm (audio) with FFMPEG
ffmpeg \
-i input1.webm \
-i https://somewhere.com/input2.webm \
-filter_complex "[0:a][1:a]concat=n=2:v=0:a=1[aout]" -map "[aout]" \
-c:a libvorbis -strict experimental \
output.webm
# Notes: [0:a][1:a] and concat=n=2 is depending on number of inputs (-i)
# you can use libvorbis or libopus as codec
@klanjabrik
klanjabrik / settings.json
Created July 11, 2019 05:49
Pylint issue in Visual Studio
{
"python.linting.pylintEnabled": true,
"python.linting.enabled": true,
"python.pythonPath": "<path to folder your python executable is in>",
"python.linting.pylintArgs": [
"--init-hook",
"import sys; sys.path.append('<path to folder your module/package is in>')"
]
}
@klanjabrik
klanjabrik / docker-compose.yml
Last active February 21, 2022 22:58
DOCKER COMPOSE KONG API GATEWAY + KONGA THE GUI
version: "3.0"
services:
kong-database:
image: postgres:9.6
restart: always
volumes:
- ./postgres-data:/var/lib/postgresql/data
environment:
- POSTGRES_USER=dbuser
- POSTGRES_PASSWORD=dbpassword