Skip to content

Instantly share code, notes, and snippets.

////////////////// Driver to generate musical tones /////////////////////
//// ////
//// generate_tone(frequency, duration) Generates wave at set ////
//// frequency (Hz) for set ////
//// duration (ms) ////
////source:https://www.ccsinfo.com/forum/viewtopic.php?t=25649 ////
/////////////////////////////////////////////////////////////////////////
//// (C) Copyright 1996,2003 Custom Computer Services ////
//// This source code may only be used by licensed users of the CCS ////
@bc080401210
bc080401210 / simplegui.java
Created January 18, 2019 14:25
Simple JFrame example in Java
package fypsol.guiexamples.ex01;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
#include<iostream>
using namespace std;
int val=23;
void intToBin(int var,int bitCount);
int main()
{
/*
* 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
@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"
/* Includes ------------------------------------------------------------------*/
#include <stdio.h>
#include "stm32f4xx.h"
#include "stm32f4_discovery.h"
#include "stm32f4_discovery_lcd.h"
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
%%==================================================================
%
% 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;
#include <16F887.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(crystal=4000000)
#define keypad_port PORTD
#define keypad_tris TRISD
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)
@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');