Skip to content

Instantly share code, notes, and snippets.

View ikbelkirasan's full-sized avatar

Ikbel ikbelkirasan

View GitHub Profile
//Leonardo
Serial_ & dbgTerminal = Serial;
HardwareSerial & espSerial = Serial1;
////UNO & M328P
//#include <SoftwareSerial.h>
//SoftwareSerial dbgTerminal(10, 11); // RX, TX
//HardwareSerial & espSerial = Serial;
//
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# by Texy and the raspberry pi community
# bitmap display routine by POSitality
# this version using the SPI pins, but not
# using spidev
# 19/1/2013
import time
import wiringpi
@ikbelkirasan
ikbelkirasan / install-opencv-2.4.11-in-ubuntu.sh
Last active September 13, 2015 12:56 — forked from dynamicguy/install-opencv-2.4.11-in-ubuntu.sh
install opencv-2.4.11 in ubuntu
# install dependencies
sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y cmake
sudo apt-get install -y libgtk2.0-dev
sudo apt-get install -y pkg-config
sudo apt-get install -y python-numpy python-dev
sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install -y libjpeg-dev libpng-dev libtiff-dev libjasper-dev
// Written by Nick Gammon
// February 2011
/**
* Send arbitrary number of bits at whatever clock rate (tested at 500 KHZ and 500 HZ).
* This script will capture the SPI bytes, when a '\n' is recieved it will then output
* the captured byte stream via the serial.
*/
#include <SPI.h>
@ikbelkirasan
ikbelkirasan / OTATest.ino
Created December 25, 2015 01:54 — forked from igrr/OTATest.ino
ESP8266 Arduino OTA example v1
#include <ESP8266WiFi.h>
#include <WiFiUDP.h>
const char* ssid = "..........";
const char* password = "...........";
WiFiUDP listener;
void setup() {
Serial.begin(115200);
@ikbelkirasan
ikbelkirasan / Arduino-IR-TX-NEC
Created May 6, 2016 18:54 — forked from EEVblog/Arduino-IR-TX-NEC
A simple Arduino driver for the NEC (Japanese) Infrared IR protocol. Drive an IR LED direct with your own code. This is a direct pin bit-bang approach, so beware about interrupts and timing difference between hardware. Feel free to use hardware PWM to generate the carrier frequency if you want better accuracy.
//*****************************************
// NEC (Japanese) Infrared code sending library for the Arduino
// Send a standard NEC 4 byte protocol direct to an IR LED on the define pin
// Assumes an IR LED connected on I/O pin to ground, or equivalent driver.
// Tested on a Freetronics Eleven Uno compatible
// Written by David L. Jones www.eevblog.com
// Youtube video explaining this code: http://www.youtube.com/watch?v=BUvFGTxZBG8
// License: Creative Commons CC BY
//*****************************************
@ikbelkirasan
ikbelkirasan / distance_from_polygon.cpp
Created July 26, 2016 06:44 — forked from atduskgreg/distance_from_polygon.cpp
Find the distance from a polygon using the Bourke line-distance algorithm for each segment. Example of it in action here: http://itp.nyu.edu/~gab305/files/gif_with_blurred_borders.gif
// example of this in action here: http://itp.nyu.edu/~gab305/files/gif_with_blurred_borders.gif
float testApp::distanceFromLine(const ofPoint & p, const ofPoint & l1, const ofPoint & l2){
float xDelta = l2.x - l1.x;
float yDelta = l2.y - l1.y;
// final double u = ((p3.getX() - p1.getX()) * xDelta + (p3.getY() - p1.getY()) * yDelta) / (xDelta * xDelta + yDelta * yDelta);
float u = ((p.x - l1.x) * xDelta + (p.y - l1.y)*yDelta) / (xDelta * xDelta + yDelta * yDelta);
ofPoint closestPointOnLine;
@ikbelkirasan
ikbelkirasan / dip_sw.ino
Created July 28, 2016 00:13 — forked from hsiboy/dip_sw.ino
read 4 position dip switch - arduino
//Create and Define Global Variables
int dipPins[] = {2, 3, 4, 5}; // DIP Switch Pins
int transAddress;
void setup()
{
Serial.begin(9600);
int i;
for(i = 0; i<=3; i++){
@ikbelkirasan
ikbelkirasan / scopes.txt
Created December 27, 2016 05:25 — forked from iambibhas/scopes.txt
Sublime Text 2: Snippet scopes
Here is a list of scopes to use in Sublime Text 2 snippets -
ActionScript: source.actionscript.2
AppleScript: source.applescript
ASP: source.asp
Batch FIle: source.dosbatch
C#: source.cs
C++: source.c++
Clojure: source.clojure
CoffeeScript: source.coffee
@ikbelkirasan
ikbelkirasan / readme.md
Created January 28, 2017 18:50 — forked from max-mapper/readme.md
ffmpeg youtube live event rtmp stream from raspberry pi with raspi camera (raspivid)
  1. compile ffmpeg for arm https://github.com/fiorix/ffmpeg-arm
  2. create youtube 'live event'. get rtmp url + session id
  3. run this:
raspivid -o - -t 0 -vf -hf -fps 30 -b 6000000 | ffmpeg -re -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -f h264 -i - -vcodec copy -acodec aac -ab 128k -g 50 -strict experimental -f flv rtmp://a.rtmp.youtube.com/live2/<SESSION>

you can tweak -b and -fps to your liking. the settings above work well for 1080p. by not specifying width or height we get the full 1920x1080 resolution from the raspi camera