Skip to content

Instantly share code, notes, and snippets.

@hdo
hdo / halloween.cpp
Created August 15, 2017 14:27
My halloween project (PIR triggered sounds)
#include "Arduino.h"
#define PIR_INPUT 11
#define DFPLAYER_OUTPUT 10
#define WAIT_TICKS_INTERVAL 1000 // each ticks is about 10ms
int ledPin = 13; // LED connected to digital pin 13
uint8_t state = 0;
volatile uint32_t ticks;
@hdo
hdo / soundboard.cpp
Created August 15, 2017 14:22
Arduino Soundboard Project with DFPlayer mini
#include <Arduino.h>
#define BUTTON_COUNT 36
#define KEYPAD_OUTPUT_BEGIN 2
#define KEYPAD_OUTPUT_END 7
#define KEYPAD_INPUT_BEGIN 8
#define KEYPAD_INPUT_END 13
@hdo
hdo / keypad.cpp
Created August 15, 2017 14:21
Arduino Example for Keypad (36 buttons 6x6 matrix)
#include <Arduino.h>
#define BUTTON_COUNT 36
#define KEYPAD_OUTPUT_BEGIN 2
#define KEYPAD_OUTPUT_END 7
#define KEYPAD_INPUT_BEGIN 8
#define KEYPAD_INPUT_END 13
uint8_t keypad_button_pressed[BUTTON_COUNT];
@hdo
hdo / netalarm.cpp
Created April 22, 2017 17:55
Minimal program to send Net Alarm to Dahua NVR
//============================================================================
// Name : main.cpp
// Author : Huy Do ([email protected])
// Version : 2017-04-22
// Description : Net Alarm Test for DAHUA NVR
//============================================================================
#include <iostream>
#include <unistd.h> // for sleep
#include <string>
@hdo
hdo / adam6050.py
Created December 7, 2016 10:35
Emulate Advantech ADAM-6050 for Synology Surveillance Station
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
import time
class Echo(DatagramProtocol):
def datagramReceived(self, data, (host, port)):
print "received %r from %s:%d" % (data, host, port)
# Login
@hdo
hdo / index2.html
Created September 14, 2016 11:56
Test Dashboard
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
@hdo
hdo / koelner_dom.svg
Created February 11, 2016 14:37
Cologne Cathredral / Kölner Dom / Vector / SVG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hdo
hdo / grbl_settings.log
Created January 14, 2016 13:51
My GRBL Settings for CNC Router (c't Hacks Sperrholzfräse)
2016-01-14
Grbl 0.9j ['$' for help]
['$H'|'$X' to unlock]
$0=40 (step pulse, usec)
$1=25 (step idle delay, msec)
$2=0 (step port invert mask:00000000)
$3=1 (dir port invert mask:00000001)
$4=0 (step enable invert, bool)
$5=0 (limit pins invert, bool)
@hdo
hdo / 3461bs_simple_counter.cpp
Created January 5, 2015 12:48
Arduino code for controlling cheap china 7-segment led tube (simple counter)
#include <Arduino.h>
#define LED_PIN 13 // LED connected to digital pin 13
#define SW_PIN 10
#define CLOCK 7
#define LATCH 5
#define DATA 6
byte VALUE_CONSTANT[] ={ B11000000, // 0
@hdo
hdo / 3461bs_module.cpp
Created January 5, 2015 12:28
Arduino code for controlling cheap china 7-segment led tube
#include <Arduino.h>
#define LED_PIN 13 // LED connected to digital pin 13
#define SW_PIN 10
#define CLOCK 7
#define LATCH 5
#define DATA 6
byte value[] ={ B11111001, // 1