Skip to content

Commit

Permalink
Merge pull request #136 from valechavezalb/main
Browse files Browse the repository at this point in the history
agregar apuntes valechavezalb
  • Loading branch information
montoyamoraga authored Sep 10, 2024
2 parents 0e393b6 + 3590827 commit 2d42114
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 6 deletions.
40 changes: 34 additions & 6 deletions 03-valechavezalb/clase-05/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ Se alimenta de una batería externa para su funcionamiento.

![texto](./conexioneslaberinto.jpeg)

**Corte de piezas en láser, en madera MDF de 15 x 20 x 3 cm**
![texto](./cortelaser.png)



## DIAGRAMA DE FLUJO DEL LABERINTO
- TAREA: quiero empezar a jugar
Expand Down Expand Up @@ -54,24 +58,48 @@ delay(10); }

*Al momento de empezar a correr el tiempo, las leds parpadean en un loop de 2 veces y luego se apga y queda en stand by.

![texto](./intento1sensor.JPG)
![texto](./intento1sensor.jpg)

2. Sensor de toque capacitivo como interruptor, no se logro adecuar para nuestro sensor ya que este ya tenia un sensor de toque capacitivo TTP2233B https://www.squids.com.br/arduino/projetos-arduino/projetos-squids/basico/257-projeto-77-sensor-de-toque-capacitivo-como-interruptor-liga-e-desliga
3. Creando un sensor capacitivo con Arduino por Xukyo https://www.aranacorp.com/es/creando-un-sensor-capacitivo-con-arduino/ código:

//Libraries #include <CapacitiveSensor.h>//https://github.com/PaulStoffregen/CapacitiveSensor //Parameters bool autocal = 0; const int numReadings = 10; long readings [numReadings]; int readIndex = 0; long total = 0; const int sensitivity = 1000; const int thresh = 200; const int csStep = 10000; CapacitiveSensor cs = CapacitiveSensor(2, 3); void setup() { //Init Serial USB Serial.begin(9600); Serial.println(F("Initialize System")); //Init cs if (autocal == 0) { { cs.set_CS_AutocaL_Millis(0xFFFFFFFF); } } } void loop() { Serial.println(smooth()); } long smooth() { /* function smooth */ ////Perform average on sensor readings long average; // subtract the last reading: total = total - readings[readIndex]; // read the sensor: readings[readIndex] = cs.capacitiveSensor(sensitivity); // add value to total: total = total + readings[readIndex]; // handle index readIndex = readIndex + 1; if (readIndex >= numReadings) { readIndex = 0; } // calculate the average: average = total / numReadings; return average; }

## CÓDIGO UTILIZADO
**timer**
#include "Arduino_LED_Matrix.h" //Include the LED_Matrix library #include "animation.h" //Include animation.h header file

// Create an instance of the ArduinoLEDMatrix class ArduinoLEDMatrix matrix;
**timer**

void setup() { pinMode(2, INPUT); pinMode(3, OUTPUT); matrix.loadSequence(animation); matrix.begin(); matrix.play(true); }
#include "Arduino_LED_Matrix.h" //Include the LED_Matrix library
#include "animation.h" //Include animation.h header file

// Create an instance of the ArduinoLEDMatrix class
ArduinoLEDMatrix matrix;

void setup() {
pinMode(2, INPUT);
pinMode(3, OUTPUT);
}

void loop() {
if (digitalRead(2) == HIGH) {
digitalWrite(3, HIGH);
matrix.loadSequence(animation);
matrix.begin();
matrix.play(true);
delay(10000);
}
else {
digitalWrite(3, LOW);
matrix.play(false);
delay(1000);
}
}

void loop() { if (digitalRead(2) == HIGH) { digitalWrite(3, HIGH); matrix.loadSequence(animation); matrix.play(true); delay(10000); } else { digitalWrite(3, LOW); matrix.play(false); delay(1000); } }

**animation.h** --> animación que sale en los leds.



{
0x36c29,
0x41081082,
Expand Down
Binary file added 03-valechavezalb/clase-05/intento1sensor.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2d42114

Please sign in to comment.