Skip to content

Instantly share code, notes, and snippets.

@SrikanthKrish
SrikanthKrish / sort1mb.cpp
Created November 23, 2012 04:23 — forked from preshing/sort1mb.cpp
Sort one million 8-digit numbers in 1MB RAM
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
typedef unsigned int u32;
typedef unsigned long long u64;
//-------------------------------------------------------------------------
// WorkArea
//-------------------------------------------------------------------------
@SrikanthKrish
SrikanthKrish / logCallByName.pde
Created June 25, 2012 18:37
log calls that have a name
void callLog(char name[])
{
Serial << "logging call" << endl;
File logData = SD.open("/contacts/log.TXT",FILE_WRITE);
Serial << logData.size() << endl;
logData.println(name);
logData.println();
@SrikanthKrish
SrikanthKrish / callLog.pde
Created June 25, 2012 18:29
To log calls
void callLog()
{
Serial << "logging call" << endl;
File logData = SD.open("/contacts/log.TXT",FILE_WRITE);
Serial << logData.size() << endl;
logData.println(ph);
@SrikanthKrish
SrikanthKrish / DTMF.pde
Created June 25, 2012 18:20
DTMF decoder code
#include <PinChangeInt.h>
#define PIN1 2
#define PIN2 3
#define PIN3 4
uint8_t latest_interrupted_pin;
uint8_t interrupt_count[20]={0}; // 20 possible arduino pins
int i;
void quicfunc() {
@SrikanthKrish
SrikanthKrish / RGB.ino
Created June 20, 2012 09:55
code for Arduino to correctly parse comma separated values of red, green and blue colors.
/*
* rgb values are sent to the arduino board and as a comma seperated list of decimal codes of 0-255
* for example rgb could look like this 213,89,46.
* This program accepts these codes form serial comm port and seperates rgb values using (,) comma as the seperator
* and sends them to the leds
*/
// global variable declarations
int incomingByte = 0; // to hold incoming serial data