06 April 2022

 

My Controller is shaping up to be a realistically simple design that is utilizing two rotary encoders in order to drive packman. You will need to grab both of them and move one up and down in order to steer him forward/back, and another controller to drive him left or right. This design game to me when thinking about paceman himself as a car and the player as someone who is steering the car all around the board. I wanted to make more of a steering wheel design for paceman though I found it more fun to have him operate as a robot. The controller will be made from Pine wood that I have cut and fit to size myself utilizing my woodshop, and though rather heavy is interesting to look at as it does indeed replicate a robot-like design.





{

#Include <Keyboard.h>

#include <Adafruit_CricuitPlayground.h>

#include <Adafruit_Cricuit_Playground.h>

 

//Connecting Pins to Encoder0PinA, encoder0PinB, and  +5V

 

//Variables

int val;

int encoder0PinA = 3;

int encoder0PinB = 4;

int encoder0Pos = 0;

int encoder0PinALast = LOW;

int n = LOW;

 

Void Setup(){

                    pinMode(encoder0PinA, INPUT);

                    pinMode(encoder0PinB, INPUT);

                    Serial.begin(9600);

 

void loop() {
  n = digitalRead(encoder0PinA);
  if ((encoder0PinALast == LOW) && (n == HIGH)) {
    if (digitalRead(encoder0PinB) == LOW) {
      encoder0Pos--;
    } else {
      encoder0Pos++;
    }
    Serial.print (encoder0Pos);
    Serial.print ("/");
  }
  encoder0PinALast = n;

}


 

 


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.