Commit 35887fe79cbc3a96d8c36ede0b90f44ff00b765b

Authored by troj
1 parent f63fc344

Commit rasp

Showing 4 changed files with 95 additions and 0 deletions   Show diff stats
dico_clavier.py 0 → 100644
@@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
  1 +from pygame.locals import *
  2 +
  3 +midi_note={}
  4 +
  5 +midi_note[K_a]=440
  6 +midi_note[K_z]=466
  7 +midi_note[K_e]=494
  8 +midi_note[K_r]=523
  9 +midi_note[K_t]=554
  10 +midi_note[K_y]=587
  11 +midi_note[K_u]=622
  12 +midi_note[K_i]=659
  13 +midi_note[K_o]=698
  14 +midi_note[K_p]=740
  15 +midi_note[K_q]=784
  16 +midi_note[K_s]=831
  17 +midi_note[K_d]=880
  18 +midi_note[K_f]=932
  19 +midi_note[K_g]=988
  20 +midi_note[K_h]=1046
  21 +midi_note[K_j]=1109
  22 +midi_note[K_k]=1175
  23 +midi_note[K_l]=1244
  24 +midi_note[K_m]=1318
  25 +midi_note[K_w]=1397
  26 +midi_note[K_x]=1480
  27 +midi_note[K_c]=1568
  28 +midi_note[K_v]=1661
  29 +midi_note[K_b]=1760
  30 +midi_note[K_n]=1865
exec.php 0 → 100755
@@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
  1 +<?php
  2 + echo "<html><body><p>";
  3 + if (isset($_POST["button"]) {
  4 + $resultat = system("sudo python /var/www/cgi-bin/main.py");
  5 + }
  6 + if (isset($_POST["live"]) {
  7 + $resultat = system("sudo python /var/www/cgi-bin/live.py");
  8 + }
  9 + echo "</p></body></html>";
  10 +?>
index.html 0 → 100755
@@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
  1 +<!DOCTYPE html>
  2 +<html>
  3 + <head>
  4 + <meta charset="UTF-8">
  5 + <link rel="stylesheet" href="css/style_index.css">
  6 + <title>P45 Orchestre Electronique - Page de test</title>
  7 + </head>
  8 + <body>
  9 + <h1> IMA4 Projets S8 - P45 Orchestre Electronique </h1>
  10 + <div class="pres">
  11 + <p class="p1"> ROJ Thomas - IMA4SC</p>
  12 + <p class="p2"> LETELLIER Joshua - IMA4SA</p>
  13 + </div>
  14 + <h3 class="desc"> Prototype d'interface WEB</h3>
  15 + <p class="part1"> Premier programme : La marche impériale
  16 + sur 2 FDD </p>
  17 +
  18 + <form action="exec.php" method="POST">
  19 + <div class="play">
  20 + <input type="submit" name="button" value="Play Imperial March">
  21 + </div>
  22 + </form>
  23 +
  24 + <form action="exec.php method="POST">
  25 + <div class="live">
  26 + <input type="submit" name="live" value="Play in live with computer input">
  27 + </div>
  28 + </form>
  29 + </body>
  30 +</html>
live.py 0 → 100644
@@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
  1 +import dico_clavier
  2 +import sys
  3 +import time
  4 +import pygame
  5 +from pygame.locals import *
  6 +from RPi import GPIO
  7 +
  8 +def main(args):
  9 + GPIO.setmode(GPIO.BCM)
  10 + GPIO.setup(23,GPIO.OUT)
  11 + GPIO.setup(24, GPIO.OUT)
  12 + GPIO.setup(25,GPIO.OUT)
  13 + GPIO.setup(18,GPIO.OUT)
  14 + p = GPIO.PWM(18,1)
  15 + p.start(35)
  16 + pygame.init()
  17 + pygame.display.set_mode((640,480))
  18 + continuer = 1
  19 + while continuer:
  20 + for event in pygame.event.get():
  21 + if (event.type == KEYDOWN):
  22 + p.ChangeFrequency(dico_clavier.midi_note[event.key])
  23 + time.sleep(0.2)
  24 +
  25 +main(sys.argv)