0 Members and 1 Guest are viewing this topic.
le nosecone fonctionne!
plus que 34 boutons
antoo a écrit:le nosecone fonctionne!!!!!!!!! youpi hourra, plus que 34 boutons (bon on fera ça le w end prochain car là on sera pas chez nous du aujourd´hui ni demain.
void loop() { while (digitalRead(2) == HIGH) { // do nothing until pin 2 goes low delay(500); } delay(1000); // new document: Keyboard.press(ctrlKey); Keyboard.press('n'); delay(100); Keyboard.releaseAll(); // wait for new window to open: delay(1000);}
void loop() { // attente que la pin 2 soit mise à zero (par defaut elle est à 5v via la résitance de pull-up - que tu dois déclarer à l'initialisation) // c'est sur cette pin que tu as ton inter - d'un tu as un fil sur la pin2 et l'autre fil sur le négatif de l'alim while (digitalRead(2) == HIGH) { // do nothing until pin 2 goes low delay(500); } delay(1000); // delay - probablement pour éviter les rebonds de l'inter ou poussoir) // On simmule la touche Ctrl Keyboard.press(ctrlKey); // On simule la touche "n" Keyboard.press('n'); delay(100); // on simule le relachement des touches Keyboard.releaseAll(); delay(1000);}
#include <Wire.h>void setup(){ Wire.begin(1); // initialisation de l'I2C comme esclave n°1 Wire.onReceive(cockpit); // définition de la fonction à appeller en cas de tentative de communication maitre->esclave Keyboard.begin(); //initialisation de la fonction keyboard}void loop(){ delay(100);}void cockpit(int bytes){ int x = Wire.read(); // variable reçue par I2C if (x==101) { Keyboard.print('b'); //raccourci clavier "b" correspondant aux aérofreins dans Orbiter } if (x==102) { Keyboard.print('i'); } if (x==103) { Keyboard.print('l'); } if (x==104) { Keyboard.print('a'); } if (x==105) { Keyboard.print('g'); } if (x==106) { Keyboard.print('o'); } if (x==107) { Keyboard.print('n'); } if (x==108) { Keyboard.print('k'); } if (x==109) { Keyboard.print(' '); } if (x==110) { Keyboard.press('*'); Keyboard.releaseAll(); } if (x==111) { Keyboard.print('5'); } if (x==112) { Keyboard.print(';'); } if (x==113) { Keyboard.print("'"); } if (x==114) { Keyboard.print('['); } if (x==115) { Keyboard.print(']'); } if (x==116) { Keyboard.print('/'); } if (x==117) { Keyboard.print('0'); } if (x==118) { Keyboard.print('.'); } if (x==119) { Keyboard.press(KEY_ESC); delay(100); Keyboard.releaseAll(); } if (x==120) { Keyboard.press(KEY_DELETE); delay(100), Keyboard.releaseAll(); } if (x==121) { Keyboard.press(KEY_INSERT); delay(100); Keyboard.releaseAll(); } if (x==122) { Keyboard.press(KEY_LEFT_CTRL); Keyboard.press('f'); delay(100); Keyboard.releaseAll(); } if (x==123) { Keyboard.press(KEY_LEFT_CTRL); Keyboard.press('i'); delay(100); Keyboard.releaseAll(); } if (x==124) { Keyboard.press(KEY_LEFT_CTRL); Keyboard.press('d'); delay(100); Keyboard.releaseAll(); } if (x==125) { Keyboard.press(KEY_LEFT_CTRL); Keyboard.press('h'); delay(100); Keyboard.releaseAll(); } if (x==126) { Keyboard.press(KEY_RIGHT_SHIFT); Keyboard.press('h'); delay(100); Keyboard.releaseAll(); } if (x==127) { Keyboard.print('h'); } if (x==128) { Keyboard.press(KEY_LEFT_CTRL); Keyboard.press('/'); delay(100); Keyboard.releaseAll(); }}