Wednesday, December 10, 2014
Arduino Danger Shield Synth DIY, chip driver
/*
This example code is in the public domain.
Freaky Steve Danger shield chip driver noise synth
*/
int val = 0;
int val12 = 1;
int sensorValue = 30; // variable to store the value coming from the sensor
int sensorValue1 = 30; // variable to store the value coming from the sensor
int sensorValue2 = 30; // variable to store the value coming from the slider
int sensorValue3 = 30; // variable to store the value coming from the photo resist
static char out = 255;
static int t = 255;
static int i = 0;
int count = 0;
ISR(TIMER1_OVF_vect){
//The timer overflows at 62.5 KHz.
//Algorithmic symphonies calls for 8khz
// Throw a counter in there to slow things down.
// It is also fun to play with the counter :-)
//http://countercomplex.blogspot.com/2011/10/algorithmic-symphonies-from-one-line-of.html
if(count < sensorValue1){
count++;
return;
}else{
count = 0;
}
/** The best so far */
out = (char)(((sensorValue1>>6|t|t>>(t>>3))*10+((t>>11)&7))|(t)*(t>>14)|(t)*(t>>9))
^(sensorValue*(t/16) |(t%13) | (sensorValue1%15))
^(sensorValue2*(t/8));
OCR1A = out;
t++;
}
// Configures TIMER1 to fast PWM non inverted mode.
// Prescaler set to 1, which means that timer overflows
// every 16MHz/256 = 62.5KHz
void initPWM(void)
{
pinMode(9, OUTPUT);
// 8-bit Fast PWM – non inverted PWM
TCCR1A= _BV(COM1A1) | _BV(WGM10);
// Start timer without prescaler
TCCR1B = _BV(CS10) | _BV(WGM12);
// Enable overflow interrupt for OCR1A
TIMSK1 = _BV(TOIE1);
}
void setup() {
initPWM();
int val = 0;
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(13, OUTPUT);
// ******** switch pins
pinMode(12, INPUT);
pinMode(11, INPUT);
pinMode(10, INPUT);
// ******** switch pins
pinMode(8, OUTPUT);
pinMode(7, OUTPUT);
pinMode(6, OUTPUT);
pinMode(5, OUTPUT);
pinMode(3, OUTPUT);
pinMode(0, OUTPUT);
pinMode(2, OUTPUT);
pinMode(1, OUTPUT);
digitalWrite(1,HIGH);
digitalWrite(2,HIGH);
digitalWrite(3,HIGH);
// *** serial in
digitalWrite(4,HIGH);
// *** serial in
digitalWrite(5,HIGH);
digitalWrite(6,HIGH);
// *** latch d7
digitalWrite(7,HIGH);
// *** clock d8
digitalWrite(8,HIGH);
// ******** switch pins
digitalRead(10);
digitalRead(11);
digitalRead(12);
// ******** switch pins
digitalWrite(13,HIGH);
}
void loop() {
initPWM();
delay(10);
val = analogRead(4);
// read the value from the sensor:
sensorValue = map(analogRead(0),0,1023,0,1023);
sensorValue1 = map(analogRead(1),0,1023,1,1023);
sensorValue2 = map(analogRead(2),0,1023,1,1023);
sensorValue3 = map(analogRead(3),0,1023,1,1023);
do{
digitalWrite(3, HIGH); // set the LED on
delay(sensorValue1); // wait for a second
digitalWrite(3, LOW); // set the LED off
delay(sensorValue2); // wait for a second
digitalWrite(1, HIGH); // set the LED on
delay(sensorValue3); // wait for a second
digitalWrite(1, LOW); // set the LED off
delay(sensorValue2); // wait for a second
sensorValue = map(analogRead(0),0,1023,1,1023);
sensorValue1 = map(analogRead(1),0,1023,1,1023);
sensorValue2 = map(analogRead(2),0,1023,1,1023);
val = digitalRead(12);
do{
tone(3, sensorValue,sensorValue2);
// set the LED off
delay(sensorValue2); // wait for a second
sensorValue = map(analogRead(0),0,1023,1,1023);
sensorValue1 = map(analogRead(1),0,1023,1,1023);
sensorValue2 = map(analogRead(2),0,1023,1,1023);
} while (sensorValue1>1000);
//
} while (sensorValue>1000);
//
digitalWrite(3, HIGH); // set the LED on
delay(100); // wait for a second
digitalWrite(3, LOW); // set the LED off
delay(100); // wait for a second
}
Thursday, November 20, 2014
Proletariat
proletariat
[proh-li-tair-ee-uh t]
1.
the class of wage earners, especially those who earn their living by manual labor or who are dependent for support on daily or casual employment; the working class.
2.
(in Marxist theory) the class of workers, especially industrial wage earners, who do not possess capital or property and must sell their labor to survive.
3.
the lowest or poorest class of people, possessing no property, especially in ancient Rome.
Monday, January 6, 2014
Subscribe to:
Posts (Atom)