This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Play Melody | |
* ----------- | |
* | |
* Program to play a simple melody | |
* | |
* Tones are created by quickly pulsing a speaker on and off | |
* using PWM, to create signature frequencies. | |
* | |
* Each note has a frequency, created by varying the period of | |
* vibration, measured in microseconds. We'll use pulse-width |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add ultrasonic distance sensor library | |
#include <NewPing.h> | |
// Disntance sensor | |
static const int echo_pin = 2; | |
static const int trigger_pin = 3; | |
static const int max_distance = 200; | |
// Piezzo buzzer | |
static const int piezo_pin = 11; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
==================== | |
AD7173 ADC test code | |
==================== | |
*/ | |
#include <SPI.h> | |
void print_byte(byte value) { | |
char format[10]; | |
sprintf(format, "0x%.2X ", value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Hanoi { | |
/* | |
* @param int - number of disks | |
*/ | |
static void solve ( int n ) { | |
// create the rods | |
IntStack rod_A = new IntStack(n); | |
IntStack rod_B = new IntStack(n); | |
IntStack rod_C = new IntStack(n); |