Log In  
Follow
matheynen

Graphist Multimedia living in Belgium in Brussels.
I do mapping projection with programming tools that I made myself with Processing.
I like the video games with a story.
I give informatics lessons in Brussel.


I, everyone.
I have a new pico-8 experience now.
I use the sparkfun joystick shield with an arduino leonardo.

Here is the code.

#include <Keyboard.h>
char btn0 = 3, btn1 = 4, btn2 = 5, btn3 = 6;
void setup() {
  pinMode(btn0, INPUT);
  digitalWrite(btn0, HIGH);
  pinMode(btn1, INPUT);
  digitalWrite(btn1, HIGH);
  pinMode(btn2, INPUT);
  digitalWrite(btn2, HIGH);
  pinMode(btn3, INPUT);
  digitalWrite(btn3, HIGH);
  Keyboard.begin();
}
void loop() {
  if (digitalRead(btn0) == LOW) Keyboard.print('x');
  if (digitalRead(btn1) == LOW) Keyboard.print('c');
  if (digitalRead(btn2) == LOW) Keyboard.print('w'); //z but I'm on azerty board, not qwerty
  if (digitalRead(btn3) == LOW) Keyboard.print('v');
  if (analogRead(0) > 524) Keyboard.write(215);
  else if (analogRead(0) < 500) Keyboard.write(216);
  if (analogRead(1) > 524) Keyboard.write(218);
  else if (analogRead(1) < 500) Keyboard.write(217);
  delay(10);//adapt it with the game
}

[ Continue Reading.. ]

2
1 comment