Operácie

Among Us Človeče: Rozdiel medzi revíziami

Zo stránky SensorWiki

StudentDTV (diskusia | príspevky)
StudentDTV (diskusia | príspevky)
 
(96 medziľahlých úprav od rovnakého používateľa nie je zobrazených.)
Riadok 12: Riadok 12:
► Pritom musia figúrky raz obísť všetky polia, bez toho, aby ju súper nevyhodil.
► Pritom musia figúrky raz obísť všetky polia, bez toho, aby ju súper nevyhodil.


► Počet prejdených polí sa určí hodom očíslovanej kocky.  
► Počet prejdených polí sa určí hodom očíslovanej kocky.
 
== Používané technológie ==
 
=== Figúrky │ 3D tlač ===
 
 
Najprv sme museli navrhnúť herné figúrky. Na to sme použili OPENSCAD.
 
Potom sme chceli, aby každá herná figúrka bola jedinečná pre 4 hráčov, preto sme navrhli 4 rôzne typy klobúkov, ktoré sme umiestnili na základný model.
 
Potom sme išli do fablabu a vytlačili sme ich v rôznych farbách.
 
 
[[Súbor:Amongus3DAll.jpg|1000px|left]]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
=== Herná plocha │ Laser ===
 
► Plocha je z dreva
 
► Hernú plochu sme vyrezali s laserom
 
► Hracie polia sú gravírované
 
 
[[Súbor:AmongusBoardSvg.png|400px|thumb|left|Doska v Inkscape]][[Súbor:AmongusBoard.jpg|400px|thumb|center|Dokončená doska]]
 
 
 
 
 
=== Kocka │ Elektronika ===
 
Rozhodli sa vytvoriť digitálnu kocku so zvukovými efektmi.
 
Použité komponenty:
 
► Arduino UNO
 
► 6 segment display
 
► Gombík
 
► Buzzer
 
► Resistor 330Ω
 
[[Súbor:ArduinoIRL.jpg|400px|left]]
[[Súbor:ArduinoSim.png|400px|left]]
 
<youtube  width=1800
| height=720>mLjCMxaiDbM</youtube>


[[Obrázok:ard.jpg|400px|thumb|center|Vývojová doska ACROB.]]


'''Literatúra:'''
* [http://ap.urpi.fei.stuba.sk/sensorwiki/index.php/Acrob_technical_description Dokumentácia k doske Acrob]
* [http://www.humanbenchmark.com/tests/reactiontime/index.php Vyskúšajte si zmerať reakciu on-line]




== Používané technológie ==
<tab name="Digital Dice"><source lang="c++" style="background: LightYellow;">


=== Figúrky - 3D tlač ===
// Constants for the 7-segment display pins
const int segmentPins[] = {2, 3, 4, 5, 6, 7, 8};


Najprv sme museli navrhnúť herné figúrky. Na to sme použili OPENSCAD. Potom sme chceli, aby každá herná figúrka bola jedinečná pre 4 hráčov, preto sme navrhli 4 rôzne typy klobúkov, ktoré sme umiestnili na základný model. Potom sme išli do fablabu a vytlačili sme ich v rôznych farbách.
// Button pin
const int buttonPin = 9;


[[Súbor:Amongus3D.jpg|400px|thumb|left]]
// Variables
int randomNumber = 0;
bool buttonPressed = false;


=== Herná plocha - Laser ===
void setup() {
  // Set the 7-segment display pins as outputs
  for (int i = 0; i < 7; i++) {
    pinMode(segmentPins[i], OUTPUT);
  }
  Serial.begin(9600);


=== Kocka - Elektronika ===
  // Set the button pin as input
  pinMode(buttonPin, INPUT_PULLUP);
 
  pinMode(12, OUTPUT);


Algoritmus programu je....
  // Initialize the random seed
  randomSeed(analogRead(0));


  // Set the initial display to 0
  displayNumber(0);
}


<tabs>
void loop() {
<tab name="AVR C-code"><source lang="c++" style="background: LightYellow;">
  // Check if the button is pressed
#include <avr/io.h>
  if (digitalRead(buttonPin) == LOW && !buttonPressed) {
    buttonPressed = true;
    Serial.print("megy");


int main(void)
    for (int i = 0; i < 10; i++){
{
          playSlotMachineSound();
   unsigned int measuredValue;
      randomNumber = random(1, 7);
    // Display the generated number
    displayNumber(randomNumber);
      delay (20);
    }
   
    // Generate a random number between 1 and 6
    randomNumber = random(1, 7);
    // Display the generated number
    displayNumber(randomNumber);
   }


   while (1)
   // Reset the button pressed flag if the button is released
  {
  if (digitalRead(buttonPin) == HIGH && buttonPressed) {
     /*  relax  */ 
     buttonPressed = false;
   }
   }
}
void playSlotMachineSound() {
  // Define the frequencies for the sound
  int frequencies[] = {262, 196, 440, 392, 349, 293};


   return(0);
   // Play the sound for a short duration
  for (int i = 0; i < 6; i++) {
    tone(12, frequencies[i], 100);
    delay(20);
    noTone(12);
    //delay(50);
  }
}
}


</source></tab>
// Display a number on the 7-segment display
<tab name="filename.h"><source lang="c++" style="background: LightYellow;">
void displayNumber(int number) {
#include <avr/io.h>
  // Define the 7-segment display patterns for each digit
  const int digitPatterns[][7] = {
    {1, 0, 0, 1, 1, 1, 1},  // 1
    {0, 0, 1, 0, 0, 1, 0},  // 2
    {0, 0, 0, 0, 1, 1, 0},  // 3
    {1, 0, 0, 1, 1, 0, 0},  // 4
    {0, 1, 0, 0, 1, 0, 0},  // 5
    {0, 1, 0, 0, 0, 0, 0},  // 6
};


void adc_init(void);                                  // A/D converter initialization
  // Display the segments for the given number
  if (number >= 1 && number <= 6) {
    // Display the segments for the given number
    for (int i = 0; i < 7; i++) {
      digitalWrite(segmentPins[i], digitPatterns[number - 1][i]);
    }
  }
}


unsigned int adc_read(char a_pin);
</source></tab>
</source></tab>
</tabs>


Pridajte sem aj zbalený kompletný projekt, napríklad takto (použite jednoznačné pomenovanie, nemôžeme mať na serveri 10x ''zdrojaky.zip'':


Zdrojový kód: [[Médiá:projektMenoPriezvisko.zip|zdrojaky.zip]]
Zdrojový kód: [[Médiá:Digital_dice_bg_hp.zip|Digital dice]]
 




=== Overenie ===


Na používanie našej aplikácie stačia dve tlačítka a postup používania je opísaný v sekcii popis riešenia.
Na konci uvádzame fotku záverečnej obrazovky pred resetom. Vypísaný je tu priemerný čas a najlepší čas.


[[Súbor:fotka.jpg|400px|thumb|center|Aplikácia.]]


'''Video:'''
<center><youtube>_l02MBu41n0</youtube></center>


Kľúčové slová 'Category', ktoré sú na konci stránky nemeňte.  
Kľúčové slová 'Category', ktoré sú na konci stránky nemeňte.  


[[Category:DTV]][[Category:DTV2023]]
[[Category:DTV]][[Category:DTV2023]]

Aktuálna revízia z 11:57, 18. jún 2023

Záverečný projekt predmetu DTV / LS2023 - Péter Heller, Gabriel Bukriš


Ako sa hrá človeče?

► Cieľom hry je dostať všetky štyri figúrky zo štartového poľa na cieľové polia.

► Po hodení šestky môže figúrka odštartovať.

► Pritom musia figúrky raz obísť všetky polia, bez toho, aby ju súper nevyhodil.

► Počet prejdených polí sa určí hodom očíslovanej kocky.

Používané technológie

Figúrky │ 3D tlač

Najprv sme museli navrhnúť herné figúrky. Na to sme použili OPENSCAD.

Potom sme chceli, aby každá herná figúrka bola jedinečná pre 4 hráčov, preto sme navrhli 4 rôzne typy klobúkov, ktoré sme umiestnili na základný model.

Potom sme išli do fablabu a vytlačili sme ich v rôznych farbách.














Herná plocha │ Laser

► Plocha je z dreva

► Hernú plochu sme vyrezali s laserom

► Hracie polia sú gravírované


Doska v Inkscape
Dokončená doska



Kocka │ Elektronika

Rozhodli sa vytvoriť digitálnu kocku so zvukovými efektmi.

Použité komponenty:

► Arduino UNO

► 6 segment display

► Gombík

► Buzzer

► Resistor 330Ω



// Constants for the 7-segment display pins
const int segmentPins[] = {2, 3, 4, 5, 6, 7, 8};

// Button pin
const int buttonPin = 9;

// Variables
int randomNumber = 0;
bool buttonPressed = false;

void setup() {
  // Set the 7-segment display pins as outputs
  for (int i = 0; i < 7; i++) {
    pinMode(segmentPins[i], OUTPUT);
  }
  Serial.begin(9600);

  // Set the button pin as input
  pinMode(buttonPin, INPUT_PULLUP);
  
  pinMode(12, OUTPUT);

  // Initialize the random seed
  randomSeed(analogRead(0));

  // Set the initial display to 0
  displayNumber(0);
}

void loop() {
  // Check if the button is pressed
  if (digitalRead(buttonPin) == LOW && !buttonPressed) {
    buttonPressed = true;
    Serial.print("megy");

    for (int i = 0; i < 10; i++){
          playSlotMachineSound();
      randomNumber = random(1, 7);
    // Display the generated number
    	displayNumber(randomNumber);
      delay (20);
    }
    
    // Generate a random number between 1 and 6
    randomNumber = random(1, 7);
    // Display the generated number
    displayNumber(randomNumber);
  }

  // Reset the button pressed flag if the button is released
  if (digitalRead(buttonPin) == HIGH && buttonPressed) {
    buttonPressed = false;
  }
}

void playSlotMachineSound() {
  // Define the frequencies for the sound
  int frequencies[] = {262, 196, 440, 392, 349, 293};

  // Play the sound for a short duration
  for (int i = 0; i < 6; i++) {
    tone(12, frequencies[i], 100);
    delay(20);
    noTone(12);
    //delay(50);
  }
}

// Display a number on the 7-segment display
void displayNumber(int number) {
  // Define the 7-segment display patterns for each digit
  const int digitPatterns[][7] = {
    {1, 0, 0, 1, 1, 1, 1},  // 1
    {0, 0, 1, 0, 0, 1, 0},  // 2
    {0, 0, 0, 0, 1, 1, 0},  // 3
    {1, 0, 0, 1, 1, 0, 0},  // 4
    {0, 1, 0, 0, 1, 0, 0},  // 5
    {0, 1, 0, 0, 0, 0, 0},  // 6
};

  // Display the segments for the given number
  if (number >= 1 && number <= 6) {
    // Display the segments for the given number
    for (int i = 0; i < 7; i++) {
      digitalWrite(segmentPins[i], digitPatterns[number - 1][i]);
    }
  }
}


Zdrojový kód: Digital dice




Kľúčové slová 'Category', ktoré sú na konci stránky nemeňte.