Skip to content

Instantly share code, notes, and snippets.

#include <16F877a.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#define init_segments() set_tris_c(0x00);
unsigned char seg_code[]=
{192,249,164,176,153,146,130,248,128,144};//a=pin0,g=pin6,dp=pin7
clear all;
close all;
clc;
%% initalize camera
vidDevice = imaq.VideoDevice('winvideo', 1, 'YUY2_320x240', ... % Acquire input video stream
'ROI', [1 1 320 240], ...
'ReturnedColorSpace', 'rgb');
clear all;
close all;
clc;
%% initalize camera
vidDevice = imaq.VideoDevice('winvideo', 1, 'YUY2_320x240', ... % Acquire input video stream
'ROI', [1 1 320 240], ...
'ReturnedColorSpace', 'rgb');
@bc080401210
bc080401210 / cam_eye_detector.m
Created June 23, 2016 16:16
detect big Eyes Pair from a live web cam feed
clear all;
close all;
clc;
%% initalize camera
vidDevice = imaq.VideoDevice('winvideo', 1, 'YUY2_320x240', ... % Acquire input video stream
'ROI', [1 1 320 240], ...
'ReturnedColorSpace', 'rgb');
radix DEC
LIST P=16F887, F=INHX8M ; change also: Configure->SelectDevice from Mplab
; auto-start at 4MHz internal osc
xtal EQU 8000000 ; do not change those without manyally changing "spbrg_value" below
baud EQU 115200 ;
; The above 3 lines can be changed and buid a bootloader for the desired frequency (and PIC type)
#include <16F887.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(crystal=4000000)
#define keypad_port PORTD
#define keypad_tris TRISD
%%==================================================================
%
% IN THE NAME OF ALLAH,
%
%simple 50hz filter, to remove line noise, implemented in iir band stop
%filter method is butter worth filter
%%
% Aquaire a Clean Workspace;
/* Includes ------------------------------------------------------------------*/
#include <stdio.h>
#include "stm32f4xx.h"
#include "stm32f4_discovery.h"
#include "stm32f4_discovery_lcd.h"
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
@bc080401210
bc080401210 / sound_recorder.py
Created October 5, 2016 12:42 — forked from mabdrabo/sound_recorder.py
Simple script to record sound from the microphone, dependencies: easy_install pyaudio
import pyaudio
import wave
FORMAT = pyaudio.paInt16
CHANNELS = 2
RATE = 44100
CHUNK = 1024
RECORD_SECONDS = 5
WAVE_OUTPUT_FILENAME = "file.wav"
/*
* LCD commands HD44780 (as per datasheet)
*/
#define LCD_CLEAR_DISPLAY 0x01 ///< Clear the display and set DDRAM address to 0
#define LCD_HOME 0x02 ///< Set DDRAM to 0, cancels any shifts
#define LCD_ENTRY_MODE 0x04 ///< Sets cursor move direction and specifies display shift
#define LCD_INCREMENT 0x02 ///< Increments (1) or decrements (0) DDRAM address by 1 when data is written or read from DDRAM @see LCD_ENTRY_MODE
#define LCD_SHIFT_LEFT 0x01 ///< Shifts the entire display (1) in direction specified by ID bit when writing to DDRAM - display moves, not cursor. @see LCD_ENTRY_MODE
#define LCD_DISPLAY_ON_OFF 0x08 ///< Sets display on/off, cursor on/off and blinking of cursor
#define LCD_DISPLAY_ON 0x04 ///< Display on/off bit @see LCD_DISPLAY_ON_OFF