Modifications

Aller à : navigation, rechercher

Run 2000

5 294 octets ajoutés, 17 avril 2018 à 06:16
-Inversion des couleurs pour le capteur lumière
|machines=Laser-Smoothignstech,
}}
 
== ''L'équipe'' ==
 
<gallery mode="packed">
File:Capture d’écran 2018-04-17.png
File:Capture d’écran 2018-04-17.png
File:Capture d’écran 2018-04-17.png
File:Capture d’écran 2018-04-17.png
</gallery>
== '''Concept''' ==
<gallery>
schema-principe.png|Schéma du cube avec les différents capteurspression-des-boutons.png| Schéma pression des boutons split
</gallery>
=== Code Processing : ===
Telecharger le code processing entier final:
[[:File:test3.pde]]
==== -Mise en aléatoire des vidéos ====
int dernier;
int encours;
int num_movies = 8;
import processing.video.*;
import processing.sound.*;
import http.requests.*;
SoundFile file;
 
 
Movie m1, m2, m3;
Movie[] movies = new Movie[num_movies];
Movie currentMovie;
 
int time =0;
 
void setup() {
//On met la fenetre à la taille de l'écran
size(displayWidth, displayHeight);
//On importe le fichier
file = new SoundFile(this, "Moderat.wav");
file.loop();
//On met la musique en boucle
for (int i = 0; i < movies.length; i++) {
movies[i] = new Movie(this, nf(i, 2, 0)+".mov");
//On installe une sélection aléatoire des vidéos (qui vont de 00.mov à 07.mov)
}
encours = 0;
dernier = encours;
currentMovie = movies[encours];
currentMovie.play();
}
 
void draw() {
 
if (millis() >= time + currentMovie.duration()*1000) {
dernier = encours;
encours = nouveau(dernier);
currentMovie.stop();
time = millis();
currentMovie = movies[encours];
}
//La vidéo qui se lance sera toujours différente de la précédente mais ne se lancera que lorque que la précedente sera finie
currentMovie.play();
image(currentMovie, 0, 0, width, height);
}
 
int nouveau(int dernier) {
boolean ok = false;
int r = dernier;
while (!ok) {
r = int(random(num_movies));
println(r);
if (r != dernier) {
ok = true;
dernier = r;
}
}
println("-");
return r;
}
 
 
void movieEvent(Movie m) {
m.read();
//On lit la vidéo
}
==== -Mise en aléatoire des vidéos ====
==== -Inversion des couleurs pour le capteur lumière ====
 
<gallery mode="packed">
File:Capture d’écran 2018light-04-16 à 23.28.59normal.png|Image d'origineFile:Capture d’écran 2018avec-04-16 à 23.28.51light.png|Inversion des couleurs</gallery>    
void draw(){
if (lightValue < 4090) {
}
}
 
==== -Split screen ====
 
 
<gallery mode="packed">
File:Capture d’écran 2018-04-16 à 23.34.21split.png|SplitScreen1File:Capture d’écran 2018-04-16 à 23.34.12split2.png|SplitScreen2
</gallery>
 
 
 
//si le bouton 1 est actif on active le premier split screen
if(button1Value==1)
{
image(currentMovie, width/2, 0, width, height);
//println(opticalInterupt+"opticalInterupt");
}
else
{
println("no valuer");
}
//si le bouton 2 est actif on active le second split screen
if(button2Value==1)
{
image(currentMovie, 0, height/2, width, height);
//println(opticalInterupt2+"opticalInterupt2");
}
else
{
println("no valuer2");
}
 
//sinon pas de split screen
==== -Glitch ====
 
 
<gallery mode="packed">
File:Capture d’écran 2018-04-16 à 23.30.41glitch.png|Effet glitch sur l'image
</gallery>
 
void draw() {
}
=== Code Photon: ===
Telecharger le code photon entier final: [[:File:photon.ino]]
 
This #include statement was automatically added by the Particle IDE.
#include <TM1637Display.h>
// This #include statement was automatically added by the Particle IDE.
//#include <TM1637Display.h>
/*
Ping sensor HC-SRO4
+ grove 4-digit display
*/
//#include <TM1637Display.h>
#define CLK 2
#define DIO 3
 
TM1637Display display(CLK, DIO);
 
int trigPin = D4;
int opti = D1;
int opti1 = D0;
int echoPin = D5;
float v = 331.5 + (0.6 * 20);
int broche_flex = A0;
int lightInput=A2;
int button1=D6;
int button2=D7;
 
double button2Value;
 
void setup()
{
display.setBrightness(0x0d);
Serial.begin(9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
 
pinMode(trigPin, OUTPUT);
pinMode(broche_flex, INPUT);
pinMode(opti,INPUT);
pinMode(opti1,INPUT);
pinMode(lightInput,INPUT);
pinMode(button1,INPUT);
pinMode(button2,INPUT);
}
 
void loop() // <3>
{
double opticalInterupt = digitalRead(opti);
double opticalInterupt2 = digitalRead(opti1);
double lightValue=analogRead(lightInput);
double button1Value=digitalRead(button1);
button2Value=digitalRead(button2);
float d=distanceCM();
float flex_capture = 4095 - analogRead(broche_flex);
//boolean appuyer=false;
display.showNumberDec(d);
display.showNumberDec(flex_capture);//Display the Variable value;
display.showNumberDec(opticalInterupt);
display.showNumberDec(opticalInterupt2);
display.showNumberDec(lightValue);
display.showNumberDec(button1Value);
display.showNumberDec(button2Value);
Serial.println(d);
Serial.println(flex_capture);
Serial.println(opticalInterupt);
Serial.println(opticalInterupt2);
Serial.println(lightValue);
Serial.println(button1Value);
Serial.println(button2Value);
//Display the Variable value;
//wait 100 milliseconds so we don't drive ourselves crazy
delay(100); // ms
envoyerJson(d, flex_capture,opticalInterupt,opticalInterupt2,lightValue,button1Value,button2Value);
}
// float Turnigy()
// {
// digitalWrite(Turnigy,LOW);
// }
 
float distanceCM(){
// send sound pulse
digitalWrite(trigPin, LOW);
delayMicroseconds(3);
digitalWrite(trigPin, HIGH);
delayMicroseconds(5);
digitalWrite(trigPin, LOW);
 
// listen for echo Pin
float tUs = pulseIn(echoPin, HIGH); // microseconds
float t = tUs / 1000.0 / 1000.0 / 2; // s
float d = t*v; // m
return d*100; // cm
}
 
 
void envoyerJson(float distance, float pression,float o,float o2,float l1,float b1,float b2) {
String json;
//On envoie les données à processing
//json = "{\"controle\":{\"pot1\":";
json = "{\"distance\":";
json = json + String(distance);
json = json + ",\"pression\":";
json = json + String(pression);
json = json + ",\"opticalInterupt\":";
json = json + String(o);
json = json + ",\"opticalInterupt2\":";
json = json + String(o2);
json = json + ",\"lightValue\":";
json = json + String(l1);
json = json + ",\"button1Value\":";
json = json + String(b1);
json = json + ",\"button2Value\":";
json = json + String(b2);
json = json + "}";
=== Code Photon: === Serial.println(json);}
== '''L'installation finale''' ==
906
modifications

Menu de navigation