Browse Source

tv

master
Slayr 1 year ago
parent
commit
3b7995f3fd

+ 59
- 0
sketches/damla-sketch/CapacitiveSensorMeerg/CapacitiveSensorMeerg.ino View File

@@ -0,0 +1,59 @@
1
+#include <CapacitiveSensor.h>
2
+
3
+/*
4
+ * CapitiveSense Library Demo Sketch
5
+ * Paul Badger 2008
6
+ * Uses a high value resistor e.g. 10M between send pin and receive pin
7
+ * Resistor effects sensitivity, experiment with values, 50K - 50M. Larger resistor values yield larger sensor values.
8
+ * Receive pin is the sensor pin - try different amounts of foil/metal on this pin
9
+ */
10
+
11
+
12
+CapacitiveSensor   cs_4_2 = CapacitiveSensor(4,2);        // 10M resistor between pins 4 & 2, pin 2 is sensor pin, add a wire and or foil if desired
13
+CapacitiveSensor   cs_4_3 = CapacitiveSensor(4,3);        // 10M resistor between pins 4 & 6, pin 6 is sensor pin, add a wire and or foil
14
+CapacitiveSensor   cs_4_5 = CapacitiveSensor(4,5);        // 10M resistor between pins 4 & 8, pin 8 is sensor pin, add a wire and or foil
15
+
16
+void setup()                    
17
+{
18
+   cs_4_2.set_CS_AutocaL_Millis(0xFFFFFFFF);     // turn off autocalibrate on channel 1 - just as an example
19
+   Serial.begin(9600);
20
+}
21
+
22
+void loop()                    
23
+{
24
+    long start = millis();
25
+    long total1 =  cs_4_2.capacitiveSensor(30);
26
+    long valCons1 = constrain(total1, 10000, 225000);
27
+    long mappedVal1 = map(valCons1, 10000, 225000, 0, 1024);
28
+    
29
+    long total2 =  cs_4_3.capacitiveSensor(30);
30
+    long valCons2 = constrain(total2, 10000, 225000);
31
+    long mappedVal2 = map(valCons2, 10000, 225000, 0, 1024);
32
+    
33
+    long total3 =  cs_4_5.capacitiveSensor(30);
34
+    long valCons3 = constrain(total3, 10000, 225000);
35
+    long mappedVal3 = map(valCons3, 10000, 225000, 0, 1024);
36
+
37
+    Serial.print(millis() - start);        // check on performance in milliseconds
38
+    Serial.print("\t");                    // tab character for debug windown spacing
39
+
40
+    Serial.print(total1);                  // print sensor output 1
41
+    Serial.print("\t");
42
+    Serial.print(total2);                  // print sensor output 2
43
+    Serial.print("\t");
44
+    Serial.println(total3);                // print sensor output 3
45
+
46
+    Serial.print(valCons1);
47
+    Serial.print("\t");
48
+    Serial.print(valCons2);
49
+    Serial.print("\t");
50
+    Serial.println(valCons3);
51
+    
52
+    Serial.print(mappedVal1);
53
+    Serial.print("\t");
54
+    Serial.print(mappedVal2);
55
+    Serial.print("\t");
56
+    Serial.println(mappedVal3);
57
+
58
+    delay(300);                             // arbitrary delay to limit data to serial port 
59
+}

+ 189
- 0
sketches/damla-sketch/Drawing2LedMatrix/Drawing2LedMatrix.ino View File

@@ -0,0 +1,189 @@
1
+#include <CapacitiveSensor.h>
2
+CapacitiveSensor   cs_4_2 = CapacitiveSensor(4,2);        // 10M resistor between pins 4 & 2, pin 2 is sensor pin, add a wire and or foil if desired
3
+
4
+int LEDPin1 = 38;
5
+int LEDPin2 = 39;
6
+int LEDPin3 = 40;
7
+int LEDPin5 = 41;
8
+int LEDPin4 = 42;
9
+int LEDPin6 = 43;
10
+int LEDPin7 = 44;
11
+int LEDPin8 = 45;
12
+int LEDPin9 = 46;
13
+int LEDPin10 = 47;
14
+int LEDPin11 = 48;
15
+int LEDPin12 = 49;
16
+int LEDPin13 = 50;
17
+int LEDPin14 = 51;
18
+int LEDPin15 = 52;
19
+int LEDPin16 = 53;
20
+
21
+void setup()                    
22
+{
23
+   cs_4_2.set_CS_AutocaL_Millis(0xFFFFFFFF);     // turn off autocalibrate on channel 1 - just as an example
24
+   Serial.begin(9600);
25
+   pinMode(LEDPin1, OUTPUT);
26
+  pinMode(LEDPin2, OUTPUT);
27
+  pinMode(LEDPin3, OUTPUT);
28
+  pinMode(LEDPin4, OUTPUT);
29
+  pinMode(LEDPin5, OUTPUT);
30
+  pinMode(LEDPin6, OUTPUT);
31
+  pinMode(LEDPin7, OUTPUT);
32
+  pinMode(LEDPin8, OUTPUT);
33
+  pinMode(LEDPin9, OUTPUT);
34
+  pinMode(LEDPin10, OUTPUT);
35
+  pinMode(LEDPin11, OUTPUT);
36
+  pinMode(LEDPin12, OUTPUT);
37
+  pinMode(LEDPin13, OUTPUT);
38
+  pinMode(LEDPin14, OUTPUT);
39
+  pinMode(LEDPin15, OUTPUT);
40
+  pinMode(LEDPin16, OUTPUT);
41
+  digitalWrite(LEDPin1, LOW);
42
+  digitalWrite(LEDPin2, LOW);
43
+  digitalWrite(LEDPin3, LOW);
44
+  digitalWrite(LEDPin4, LOW);
45
+  digitalWrite(LEDPin5, LOW);
46
+  digitalWrite(LEDPin6, LOW);
47
+  digitalWrite(LEDPin7, LOW);
48
+  digitalWrite(LEDPin8, LOW);
49
+  digitalWrite(LEDPin9, LOW);
50
+  digitalWrite(LEDPin10, LOW);
51
+  digitalWrite(LEDPin11, LOW);
52
+  digitalWrite(LEDPin12, LOW);
53
+  digitalWrite(LEDPin13, LOW);
54
+  digitalWrite(LEDPin14, LOW);
55
+  digitalWrite(LEDPin15, LOW);
56
+  digitalWrite(LEDPin16, LOW);
57
+}
58
+
59
+void loop()                    
60
+{
61
+    long start = millis();
62
+    long total1 =  cs_4_2.capacitiveSensor(30);
63
+    long valCons = constrain(total1, 10000, 280000);
64
+    long mappedVal = map(valCons, 10000, 280000, 0, 1024);
65
+  
66
+if (mappedVal >200) {
67
+digitalWrite(LEDPin1, HIGH);
68
+}
69
+else {
70
+digitalWrite(LEDPin1, LOW);
71
+}
72
+
73
+if (mappedVal >345) {
74
+digitalWrite(LEDPin2, HIGH);
75
+}
76
+else {
77
+digitalWrite(LEDPin2, LOW);
78
+}
79
+
80
+if (mappedVal >400) {
81
+digitalWrite(LEDPin3, HIGH);
82
+}
83
+else {
84
+digitalWrite(LEDPin3, LOW);
85
+}
86
+
87
+if (mappedVal >367) {
88
+digitalWrite(LEDPin4, HIGH);
89
+}
90
+else {
91
+digitalWrite(LEDPin4, LOW);
92
+}
93
+
94
+if (mappedVal >993) {
95
+digitalWrite(LEDPin5, HIGH);
96
+}
97
+else {
98
+digitalWrite(LEDPin5, LOW);
99
+}
100
+
101
+if (mappedVal >398) {
102
+digitalWrite(LEDPin6, HIGH);
103
+}
104
+else {
105
+digitalWrite(LEDPin6, LOW);
106
+}
107
+
108
+if (mappedVal >912) {
109
+digitalWrite(LEDPin7, HIGH);
110
+}
111
+else {
112
+digitalWrite(LEDPin7, LOW);
113
+}
114
+
115
+if (mappedVal >800) {
116
+digitalWrite(LEDPin8, HIGH);
117
+}
118
+else {
119
+digitalWrite(LEDPin8, LOW);
120
+}
121
+
122
+if (mappedVal >622) {
123
+digitalWrite(LEDPin9, HIGH);
124
+}
125
+else {
126
+digitalWrite(LEDPin9, LOW);
127
+}
128
+
129
+if (mappedVal >22) {
130
+digitalWrite(LEDPin10, HIGH);
131
+}
132
+else {
133
+digitalWrite(LEDPin10, LOW);
134
+}
135
+
136
+if (mappedVal >114) {
137
+digitalWrite(LEDPin11, HIGH);
138
+}
139
+else {
140
+digitalWrite(LEDPin11, LOW);
141
+}
142
+
143
+if (mappedVal >112) {
144
+digitalWrite(LEDPin12, HIGH);
145
+}
146
+else {
147
+digitalWrite(LEDPin12, LOW);
148
+}
149
+
150
+if (mappedVal >313) {
151
+digitalWrite(LEDPin13, HIGH);
152
+}
153
+else {
154
+digitalWrite(LEDPin13, LOW);
155
+}
156
+
157
+if (mappedVal >214) {
158
+digitalWrite(LEDPin14, HIGH);
159
+}
160
+else {
161
+digitalWrite(LEDPin14, LOW);
162
+}
163
+
164
+if (mappedVal >315) {
165
+digitalWrite(LEDPin15, HIGH);
166
+}
167
+else {
168
+digitalWrite(LEDPin15, LOW);
169
+}
170
+
171
+if (mappedVal >100) {
172
+digitalWrite(LEDPin16, HIGH);
173
+}
174
+else {
175
+digitalWrite(LEDPin16, LOW);
176
+}
177
+
178
+    
179
+    Serial.print(total1);
180
+    
181
+    Serial.print("\t");
182
+    Serial.print(valCons);
183
+
184
+    Serial.print("\t");
185
+    Serial.println(mappedVal);                  // print sensor output 1
186
+    
187
+    delay(100);                             // arbitrary delay to limit data to serial port 
188
+ 
189
+}

+ 225
- 0
sketches/damla-sketch/Drawing2LedMatrix_breathe/Drawing2LedMatrix_breathe.ino View File

@@ -0,0 +1,225 @@
1
+#include <CapacitiveSensor.h>
2
+CapacitiveSensor   cs_4_2 = CapacitiveSensor(4,2);        // 10M resistor between pins 4 & 2, pin 2 is sensor pin, add a wire and or foil if desired
3
+
4
+int LEDPin1 = 38;
5
+int LEDPin2 = 39;
6
+int LEDPin3 = 40;
7
+int LEDPin5 = 41;
8
+int LEDPin4 = 42;
9
+int LEDPin6 = 43;
10
+int LEDPin7 = 44;
11
+int LEDPin8 = 45;
12
+int LEDPin9 = 46;
13
+int LEDPin10 = 47;
14
+int LEDPin11 = 48;
15
+int LEDPin12 = 49;
16
+int LEDPin13 = 50;
17
+int LEDPin14 = 51;
18
+int LEDPin15 = 52;
19
+int LEDPin16 = 53;
20
+
21
+void setup()                    
22
+{
23
+   cs_4_2.set_CS_AutocaL_Millis(0xFFFFFFFF);     // turn off autocalibrate on channel 1 - just as an example
24
+   Serial.begin(9600);
25
+   pinMode(LEDPin1, OUTPUT);
26
+  pinMode(LEDPin2, OUTPUT);
27
+  pinMode(LEDPin3, OUTPUT);
28
+  pinMode(LEDPin4, OUTPUT);
29
+  pinMode(LEDPin5, OUTPUT);
30
+  pinMode(LEDPin6, OUTPUT);
31
+  pinMode(LEDPin7, OUTPUT);
32
+  pinMode(LEDPin8, OUTPUT);
33
+  pinMode(LEDPin9, OUTPUT);
34
+  pinMode(LEDPin10, OUTPUT);
35
+  pinMode(LEDPin11, OUTPUT);
36
+  pinMode(LEDPin12, OUTPUT);
37
+  pinMode(LEDPin13, OUTPUT);
38
+  pinMode(LEDPin14, OUTPUT);
39
+  pinMode(LEDPin15, OUTPUT);
40
+  pinMode(LEDPin16, OUTPUT);
41
+  digitalWrite(LEDPin1, LOW);
42
+  digitalWrite(LEDPin2, LOW);
43
+  digitalWrite(LEDPin3, LOW);
44
+  digitalWrite(LEDPin4, LOW);
45
+  digitalWrite(LEDPin5, LOW);
46
+  digitalWrite(LEDPin6, LOW);
47
+  digitalWrite(LEDPin7, LOW);
48
+  digitalWrite(LEDPin8, LOW);
49
+  digitalWrite(LEDPin9, LOW);
50
+  digitalWrite(LEDPin10, LOW);
51
+  digitalWrite(LEDPin11, LOW);
52
+  digitalWrite(LEDPin12, LOW);
53
+  digitalWrite(LEDPin13, LOW);
54
+  digitalWrite(LEDPin14, LOW);
55
+  digitalWrite(LEDPin15, LOW);
56
+  digitalWrite(LEDPin16, LOW);
57
+}
58
+
59
+void loop()                    
60
+{
61
+    long start = millis();
62
+    long rawSensor =  cs_4_2.capacitiveSensor(30);
63
+    
64
+    constrain(rawSensor, 0, 30000);
65
+    int drawingSensor = map(rawSensor, 0, 30000, 0, 950);
66
+
67
+   if (drawingSensor >200) {
68
+  digitalWrite(LEDPin1, HIGH);
69
+  delay(10);
70
+  digitalWrite(LEDPin1, LOW);
71
+}
72
+else {
73
+  digitalWrite(LEDPin1, LOW);
74
+}
75
+
76
+  if (drawingSensor >345) {
77
+  digitalWrite(LEDPin2, HIGH);
78
+  delay(10);
79
+  digitalWrite(LEDPin2, LOW);
80
+}
81
+else {
82
+  digitalWrite(LEDPin2, LOW);
83
+}
84
+
85
+  if (drawingSensor >543) {
86
+  digitalWrite(LEDPin3, HIGH);
87
+  delay(30);
88
+  digitalWrite(LEDPin3, LOW);
89
+}
90
+else {
91
+  digitalWrite(LEDPin3, LOW);
92
+}
93
+
94
+  if (drawingSensor >467) {
95
+  digitalWrite(LEDPin4, HIGH);
96
+  delay(15);
97
+  digitalWrite(LEDPin4, LOW);
98
+}
99
+else {
100
+  digitalWrite(LEDPin4, LOW);
101
+}
102
+
103
+  if (drawingSensor >793) {
104
+  digitalWrite(LEDPin5, HIGH);
105
+  delay(20);
106
+  digitalWrite(LEDPin5, LOW);
107
+}
108
+else {
109
+  digitalWrite(LEDPin5, LOW);
110
+
111
+}
112
+
113
+if (drawingSensor >398) {
114
+  digitalWrite(LEDPin6, HIGH);
115
+  delay(10);
116
+  digitalWrite(LEDPin6, LOW);
117
+}
118
+else {
119
+  digitalWrite(LEDPin6, LOW);
120
+
121
+}
122
+
123
+  if (drawingSensor >612) {
124
+  digitalWrite(LEDPin7, HIGH);
125
+  delay(10);
126
+  digitalWrite(LEDPin7, LOW);
127
+}
128
+else {
129
+  digitalWrite(LEDPin7, LOW);
130
+}
131
+
132
+  if (drawingSensor >709) {
133
+  digitalWrite(LEDPin8, HIGH);
134
+  delay(10);
135
+  digitalWrite(LEDPin8, LOW);
136
+}
137
+else {
138
+  digitalWrite(LEDPin8, LOW);
139
+}
140
+
141
+  if (drawingSensor >622) {
142
+  digitalWrite(LEDPin9, HIGH);
143
+  delay(10);
144
+  digitalWrite(LEDPin9, LOW);
145
+}
146
+else {
147
+  digitalWrite(LEDPin9, LOW);
148
+}
149
+
150
+  if (drawingSensor >22) {
151
+  digitalWrite(LEDPin10, HIGH);
152
+  delay(10);
153
+  digitalWrite(LEDPin10, LOW);
154
+}
155
+else {
156
+  digitalWrite(LEDPin10, LOW);
157
+}
158
+
159
+  if (drawingSensor >114) {
160
+  digitalWrite(LEDPin11, HIGH);
161
+  delay(10);
162
+  digitalWrite(LEDPin11, LOW);
163
+}
164
+else {
165
+  digitalWrite(LEDPin11, LOW);
166
+}
167
+
168
+  if (drawingSensor >712) {
169
+  digitalWrite(LEDPin12, HIGH);
170
+  delay(10);
171
+  digitalWrite(LEDPin12, LOW);
172
+}
173
+else {
174
+  digitalWrite(LEDPin12, LOW);
175
+}
176
+
177
+  if (drawingSensor >313) {
178
+  digitalWrite(LEDPin13, HIGH);
179
+  delay(10);
180
+  digitalWrite(LEDPin13, LOW);
181
+}
182
+else {
183
+  digitalWrite(LEDPin13, LOW);
184
+}
185
+
186
+  if (drawingSensor >814) {
187
+  digitalWrite(LEDPin14, HIGH);
188
+  delay(10);
189
+  digitalWrite(LEDPin14, LOW);
190
+}
191
+else {
192
+  digitalWrite(LEDPin14, LOW);
193
+}
194
+
195
+  if (drawingSensor >815) {
196
+  digitalWrite(LEDPin15, HIGH);
197
+  delay(10);
198
+  digitalWrite(LEDPin15, LOW);
199
+}
200
+else {
201
+  digitalWrite(LEDPin15, LOW);
202
+}
203
+
204
+  if (drawingSensor >800) {
205
+  digitalWrite(LEDPin16, HIGH);
206
+  delay(10);
207
+  digitalWrite(LEDPin16, LOW);
208
+  
209
+}
210
+else {
211
+  digitalWrite(LEDPin16, LOW);
212
+}
213
+  
214
+    
215
+    //Serial.print(millis() - start);        // check on performance in milliseconds
216
+    //Serial.print("\t");                    // tab character for debug windown spacing
217
+    //Serial.print("Raw Sensor Value ");
218
+    //Serial.print("\t");
219
+    //Serial.println(rawSensor);                  // print sensor output 1
220
+    Serial.print("Mapped Sensor Value ");
221
+    Serial.print("\t");
222
+    Serial.println(drawingSensor);
223
+ 
224
+    //delay(1000);                             // arbitrary delay to limit data to serial port 
225
+}

+ 159
- 0
sketches/damla-sketch/memphis-drawing/memphis-drawing.ino View File

@@ -0,0 +1,159 @@
1
+#include <CapacitiveSensor.h>
2
+
3
+#include <stdint.h>
4
+#include <avr/interrupt.h>
5
+#include <avr/io.h>
6
+#include <avr/pgmspace.h>
7
+
8
+#include "sample.h"
9
+
10
+#define LED_PIN     13
11
+#define SPEAKER_PIN 11 
12
+
13
+#define KNOB_1  (0)
14
+#define KNOB_2  (1)  
15
+#define KNOB_3  (2)   
16
+#define INPUT_3 (3)   
17
+
18
+volatile uint16_t sample;
19
+volatile uint16_t loop_start;
20
+volatile uint16_t loop_length;
21
+volatile uint16_t index_bounds;
22
+volatile uint16_t loop_overflow;
23
+
24
+volatile boolean gate;
25
+volatile boolean gate_prev;
26
+
27
+byte lastSample;
28
+
29
+CapacitiveSensor   cs_4_2 = CapacitiveSensor(4,2);        // 10M resistor between pins 4 & 2, pin 2 is sensor pin, add a wire and or foil if desired
30
+CapacitiveSensor   cs_4_3 = CapacitiveSensor(4,3);        // 10M resistor between pins 4 & 6, pin 6 is sensor pin, add a wire and or foil
31
+CapacitiveSensor   cs_4_5 = CapacitiveSensor(4,5);        // 10M resistor between pins 4 & 8, pin 8 is sensor pin, add a wire and or foil
32
+
33
+
34
+void startPlayback()
35
+{
36
+    pinMode(SPEAKER_PIN, OUTPUT);
37
+
38
+    // Set up Timer 2 to do pulse width modulation on the speaker pin.
39
+    // Use internal clock (datasheet p.160)
40
+    ASSR &= ~(_BV(EXCLK) | _BV(AS2));
41
+
42
+    // Set fast PWM mode  (p.157)
43
+    TCCR2A |= _BV(WGM21) | _BV(WGM20);
44
+    TCCR2B &= ~_BV(WGM22);
45
+
46
+    // Do non-inverting PWM on pin OC2A (p.155)
47
+    // On the Arduino this is pin 11.
48
+    TCCR2A = (TCCR2A | _BV(COM2A1)) & ~_BV(COM2A0);
49
+    TCCR2A &= ~(_BV(COM2B1) | _BV(COM2B0));
50
+    // No prescaler (p.158)
51
+    TCCR2B = (TCCR2B & ~(_BV(CS12) | _BV(CS11))) | _BV(CS10);
52
+
53
+    // Set initial pulse width to the first sample.
54
+    OCR2A = pgm_read_byte(&sound_data[0]);
55
+
56
+    // Set up Timer 1 to send a sample every interrupt.
57
+    cli();
58
+
59
+    // Set CTC mode (Clear Timer on Compare Match) (p.133)
60
+    // Have to set OCR1A *after*, otherwise it gets reset to 0!
61
+    TCCR1B = (TCCR1B & ~_BV(WGM13)) | _BV(WGM12);
62
+    TCCR1A = TCCR1A & ~(_BV(WGM11) | _BV(WGM10));
63
+
64
+    // No prescaler (p.134)
65
+    TCCR1B = (TCCR1B & ~(_BV(CS12) | _BV(CS11))) | _BV(CS10);
66
+
67
+    // Set the compare register (OCR1A).
68
+    // OCR1A is a 16-bit register, so we have to do this with
69
+    // interrupts disabled to be safe.
70
+    OCR1A = F_CPU / SAMPLE_RATE; // 16e6 / 8000 = 2000
71
+
72
+    // Enable interrupt when TCNT1 == OCR1A (p.136)
73
+    TIMSK1 |= _BV(OCIE1A);
74
+
75
+    lastSample = pgm_read_byte(&sound_data[sound_length - 1]);
76
+    sample = 0;
77
+    sei();
78
+}
79
+
80
+void stopPlayback()
81
+{
82
+    TIMSK1 &= ~_BV(OCIE1A); // Disable playback per-sample interrupt.
83
+    TCCR1B &= ~_BV(CS10);   // Disable the per-sample timer completely.
84
+    TCCR2B &= ~_BV(CS10);   // Disable the PWM timer.
85
+    digitalWrite(SPEAKER_PIN, LOW);
86
+}
87
+
88
+void setup()
89
+{
90
+    
91
+    pinMode(LED_PIN, OUTPUT);
92
+    digitalWrite(LED_PIN, HIGH);
93
+
94
+    startPlayback();
95
+
96
+    loop_start  = 0; 
97
+    loop_length = sound_length;
98
+    gate = false;
99
+    gate_prev = false;
100
+}
101
+
102
+// This is called at 8000 Hz to load the next sample.
103
+ISR(TIMER1_COMPA_vect)
104
+{
105
+    if(sample >= index_bounds)
106
+    {
107
+        sample = loop_start;
108
+    }
109
+    else if((sample < loop_start) &&
110
+            (sample >= loop_overflow))
111
+    {
112
+        sample = loop_start;
113
+    }
114
+    else if((gate == true) &&
115
+            (gate_prev == false))
116
+    {
117
+        sample = loop_start;
118
+    }
119
+    else
120
+    {
121
+        OCR2A = pgm_read_byte(&sound_data[sample % sound_length]);
122
+    }
123
+    gate_prev = gate;
124
+    sample++;
125
+}
126
+
127
+void loop()
128
+{
129
+long start = millis();
130
+    long total1 =  cs_4_2.capacitiveSensor(30);
131
+    long valCons1 = constrain(total1, 10000, 225000);
132
+    long mappedVal1 = map(valCons1, 10000, 225000, 0, 1024);
133
+    
134
+    long total2 =  cs_4_3.capacitiveSensor(30);
135
+    long valCons2 = constrain(total2, 10000, 225000);
136
+    long mappedVal2 = map(valCons2, 10000, 225000, 0, 1024);
137
+    
138
+    long total3 =  cs_4_5.capacitiveSensor(30);
139
+    long valCons3 = constrain(total3, 10000, 225000);
140
+    long mappedVal3 = map(valCons3, 10000, 225000, 0, 1024);
141
+
142
+    
143
+    loop_start = mappedVal3 / 1024.0 * sound_length;
144
+    loop_length = (mappedVal2 + 1) / 1024.0 * sound_length;
145
+    OCR1A = (512.0 / (mappedVal1 + 1)) * (F_CPU / SAMPLE_RATE);
146
+    gate = analogRead(3) >> 9;  // 10 bits in. gate < 512 == off, gate >= 512 == on
147
+
148
+//  can be up to 2x sound length. the more you know.
149
+    index_bounds = loop_start + loop_length;
150
+//  this will set the overflow length. take the loop overflow into account when checking the loop boundaries
151
+    if(index_bounds > sound_length)
152
+    {
153
+        loop_overflow = index_bounds - sound_length;
154
+    }
155
+    else
156
+    {
157
+        loop_overflow = 0;
158
+    }
159
+}

BIN
sketches/damla-sketch/memphis-drawing/sample.h View File


+ 6
- 6
sketches/my_sk_sandra/catdogmousetv/catdogmousetv.ino View File

@@ -9,10 +9,10 @@ int toggle_2;
9 9
 int toggle_1;
10 10
 
11 11
 char poetry;
12
-char animal1[] = "   cat";
13
-char animal2[] = "   dog";
14
-char animal3[] = "   mouse";
15
-char animal4[]= "   cockroach";
12
+char animal1[] = "cat";
13
+char animal2[] = "dog";
14
+char animal3[] = "mouse";
15
+char animal4[]= "cockroach";
16 16
 
17 17
 char str[] = "hello"; 
18 18
 char str2[] = "CAT";
@@ -40,8 +40,8 @@ void setup() {
40 40
   // put your setup code here, to run once:
41 41
   x=0;
42 42
   y=0;
43
-  TV.begin(_NTSC,128,96);
44
-  TV.select_font(font4x6);
43
+  TV.begin(_NTSC,120,96);
44
+  TV.select_font(font6x8);
45 45
 }
46 46
   
47 47
 

Loading…
Cancel
Save