top of page
Programme fait à partir de Processing pour pouvoir communiquer grâce à une horloge et à partir du morse.

int code  = 0;
int angle =0;
String message="";
void setup () {
  size(500, 500);
  frameRate(60);
}
void draw() {
  background(200);
affichage_code();
  // clock face
  translate(width*.5, height*.5);
  // dessiner le cadran
  stroke(0, 0, 0);
  strokeWeight(5);
  ellipse(0, 0, width*.9, width*.9);

  // drawing 8 marks
  pushMatrix();

  for (int i = 0; i<360; i+=8) {
    rotate(radians(45));
    line(0, -width*.38, 0, -width*.41);
  }
  popMatrix();

  // drawing hour hand
  pushMatrix();
  strokeWeight(20);
  rotate(radians(hour()*30));
  line(0, 0, 0, -width*.3);
  popMatrix();

  // drawing minute hand
  pushMatrix();
  strokeWeight(10);
  rotate(radians(minute()*6));
  line(0, 0, 0, -width*.35);
  popMatrix();

  // drawing second hand
  pushMatrix();
  strokeWeight(5);
  stroke(255, 0, 0);
  if ( code == 0) {
    rotate(radians(0));
  }
  if ( code ==1) {
    
      angle++;
    
    rotate(radians(angle));
    if (angle == 5) {
      code=0; angle =0;
    }
  }
  if ( code ==2) {
     angle++;
    rotate(radians(angle));
    if (angle == 25) {
      code=0; angle =0;
    }
  }
  line(0, 0, 0, -width*.4);
  popMatrix();


}

void affichage_code(){
  textSize(15);
 text( "Message codé = "+ message,20,20);
 text( "Message décodé "+ message,20,480);}

void keyPressed() {
  if (key == 'a' ) {
    code =1;
    message = message +". ";
  } //dot
  if (key == 'z' ) {
    code =2;
     message = message +"- "  ;
  }// dash
  println("code "+code);
}

 

© 2023 by Name of Site. Proudly created with Wix.com

  • Facebook Social Icon
  • Twitter Social Icon
  • Google+ Social Icon
bottom of page