Diferencia entre revisiones de «Vibrómetro»
Sin resumen de edición |
Sin resumen de edición |
||
| (No se muestran 4 ediciones intermedias del mismo usuario) | |||
| Línea 2: | Línea 2: | ||
<gallery> | <gallery> | ||
Ic_vs_displ_tcst2103.png | |||
Vibrometro control.jpg | amplificador (estamos usando 1k en lugar de 200 ohmios) | Vibrometro control.jpg | amplificador (estamos usando 1k en lugar de 200 ohmios) | ||
Sensor colores.jpg | sensor (estamos usando 1k en lugar de 470 ohmios) | Sensor colores.jpg | sensor (estamos usando 1k en lugar de 470 ohmios) | ||
Parlante y sensor.jpg | parlante y sensor | Parlante y sensor.jpg | parlante y sensor | ||
Internal-circuit-of-tda2030.png | |||
A-simplified-circuit-diagram-of-a-TDA2030-from-TDA-series-power-amplifiers-14-15.png | |||
</gallery> | </gallery> | ||
| Línea 25: | Línea 28: | ||
const int control_pin = 25; | const int control_pin = 25; | ||
const int bias_pin = 26; | const int bias_pin = 26; | ||
void setup() { | |||
Serial.begin(115200); | |||
dacWrite(bias_pin, 150); | |||
pinMode(34, INPUT); | pinMode(34, INPUT); | ||
analogSetAttenuation(ADC_0db); | analogSetAttenuation(ADC_0db); | ||
} | |||
int dac = 127; | |||
void loop() { | void loop() { | ||
int x = analogRead(34); | |||
if (x > 2500) dac++; | |||
if (x < 1500) dac--; | |||
if (dac < 0) dac = 0; | |||
if (dac > 255) dac = 255; | |||
dacWrite(control_pin, dac); | |||
Serial.print("0 5000 "); | |||
Serial.print(dac * 10); | |||
Serial.print(" "); | |||
Serial.println(x); | |||
delay(1); | |||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||