Skip to content

Instantly share code, notes, and snippets.

@withlovee
withlovee / Lab 5-1.c
Last active December 21, 2015 02:59 — forked from nuttt/Lab 5-1.c
#include <avr/io.h>
#include <avr/interrupt.h>
#define F_CPU 16000000UL
#include <util/delay.h>
#define nC 30577
#define nD 27242
#define nE 24269
#define nF 22907
#define nG 20408
@withlovee
withlovee / Lab5-2.c
Created August 8, 2013 07:16
Lab5-2.c
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/eeprom.h>
#define F_CPU 16000000UL
#include <util/delay.h>
#define C 60
#define D 53
#define E 47
#define F 44
@withlovee
withlovee / Lab5-1.c
Created August 8, 2013 07:15
Lab5-1.c
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/eeprom.h>
#define F_CPU 16000000UL
#include <util/delay.h>
#define C 60
#define D 53
#define E 47
#define F 44
@withlovee
withlovee / lab4-2.c
Created August 8, 2013 05:02
Lab4-2
#include <avr/io.h>
int main (void)
{
DDRB |= (1 << 1);
ADCSRA |= (1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0); // Set ADC prescalar to 128 - 125KHz sample rate @ 16MHz
ADMUX |= (1 << REFS0); // Set ADC reference to AVCC
//ADMUX |= (1 << ADLAR); // Left adjust ADC result to allow easy 8 bit reading
@withlovee
withlovee / SceneDrawer.cpp
Created August 5, 2013 09:17
Ball with both hands (multiple players) C:\Program Files (x86)\OpenNI\Samples\NiUserTracker
/****************************************************************************
* *
* OpenNI 1.x Alpha *
* Copyright (C) 2011 PrimeSense Ltd. *
* *
* This file is part of OpenNI. *
* *
* OpenNI is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as published *
* by the Free Software Foundation, either version 3 of the License, or *
@withlovee
withlovee / ก้านกล้วย-top-down.cpp
Created July 22, 2013 04:09
Top Down Approach ก้่านกล้วย
#include <cstdio>
#include <cstdlib>
using namespace std;
int m[] = {0,0,1,0,1,1,1,0,0,0,1,1,0,1,1,1,0,0};
int k[20];
int length = 17;
int mem[20];
#include <cstdio>
#include <cstdlib>
using namespace std;
int m[] = {0,0,1,0,1,1,1,0,0,0,1,1,0,1,1,1,0,0};
int k[20];
int length = 17;
int mem[20];
@withlovee
withlovee / gist:6051160
Created July 22, 2013 03:41
Rod Cutting
#include <stdio.h>
#define INF 999999
int mem[1000][1000];
int X[] = {0,25,50,75,100};
int N = 3;
int main(){
for(int L=N; L>=0; L--){
for(int R=L+1; R<=N+1; R++){
@withlovee
withlovee / boo.cpp
Last active December 19, 2015 21:38 — forked from nuttt/boo.cpp
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <iostream>
using namespace std;
int main(){
vector<pair< int, pair<int,int> > > elephant;
@withlovee
withlovee / playVideo.cpp
Created July 8, 2013 06:50
OpenCV Play Video (old version)
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
int main(int argc, char *argv[]){
IplImage *frame;
int key = 'a';