Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Electronic_Chicken_of_DoomSpaceGodzilla123
Published

Pneumatic Marshmallow Gun Turret Using WiFi

Adafruit app-controlled marshmallow gun turret that shoots 5-10 painful high-velocity mini marshmallow rounds in less than a second.

IntermediateShowcase (no instructions)1,595
Pneumatic Marshmallow Gun Turret Using WiFi

Things used in this project

Hardware components

Bench Power Supply, DC
Bench Power Supply, DC
×1
Adafruit Feather HUZZAH with ESP8266 WiFi
Adafruit Feather HUZZAH with ESP8266 WiFi
×1
Rain Bird HV & HVF Series Valves
×1
Stepper Motor, Mini Step
Stepper Motor, Mini Step
×1
Wire, PVC
Wire, PVC
×1
Marshmallows
×1
Flex Seal
×1
Adafruit DC Motor + Stepper FeatherWing
×1

Hand tools and fabrication machines

Laser cutter (generic)
Laser cutter (generic)
Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Code

Code for the IDE for the feather board

Arduino
Just plug it into the Huzza, with the password and username of the wifi that you want to use
#include "config.h"
#include <Wire.h>
#include <AccelStepper.h>
#include <Adafruit_MotorShield.h>
// These constants won't change.  They're used to give names
// to the pins used:
int Step1 = MICROSTEP;
int Step2 = MICROSTEP;

/*
 * 5 = up
 * 13 = down
 * 
 * 8 = left
 * 10 = right
 * 
 * 9 = Shoot
 * 
 */



Adafruit_MotorShield AFMS = Adafruit_MotorShield();
Adafruit_StepperMotor *myStepper1 = AFMS.getStepper(200, 1);
Adafruit_StepperMotor *myStepper2 = AFMS.getStepper(200, 2);


 
  

void forwardstep1() {  
  myStepper1->step(20, FORWARD, Step1);
  

}
void backwardstep1() {  
  myStepper1->step(20, BACKWARD, Step1);
  
}

void forwardstep2() {  
  myStepper2->step(20, FORWARD, Step2);
  
}
void backwardstep2() {  
  myStepper2->step(20, BACKWARD, Step2);
  
}

//AccelStepper Astepper1(forwardstep1, backwardstep1);
//AccelStepper Astepper2(forwardstep2, backwardstep2);


//const int button = 5;
//const int solinoid = 10;



//int pushbutton = 0;

AdafruitIO_Feed *xAxsis = io.feed("Yeet");
//AdafruitIO_Feed *yAxsis = io.feed("yAxsis");


void setup() {
  // initialize serial communications at 9600 bps:
  Serial.begin(115200);
  AFMS.begin();
  // wait for serial monitor to open
  while(! Serial);

  // connect to io.adafruit.com
  Serial.print("Connecting to Adafruit IO");
  io.connect();

  xAxsis->onMessage(handleMessage);

  // wait for a connection
  while(io.status() < AIO_CONNECTED) {
    Serial.print(io.statusText());
    delay(500);
  }
  
  Serial.println();
  Serial.println(io.statusText());
  
  xAxsis->get();
  //yAxsis->get();


//  pinMode(solinoid, OUTPUT);
  //pinMode(button, INPUT);
  myStepper1->setSpeed(50);
  myStepper2->setSpeed(20);
  
}

void loop() {

  io.run();

}



void handleMessage(AdafruitIO_Data *data) {
// convert the data to integer
  int in = data->toInt();
  Serial.print("received <- ");
  Serial.println(in);


switch(in){
 case 5:
forwardstep2();

break;

 case 13:
backwardstep2();

break;
 case 8:
forwardstep1();
myStepper1->release();
break;
  case 10:
backwardstep1();
myStepper1->release();
break;


 }
     //myStepper2->release();

Serial.println( "Yay");
delay(10);
}

config.h

Arduino
Make sure to put this on the second tab on your Arduino IDE when uploading. Make sure that you put the username and password for your wifi here
/************************ Adafruit IO Config *******************************/

// visit io.adafruit.com if you need to create an account,
// or if you need your Adafruit IO key.
#define IO_USERNAME  "Your IO Username from your Adafruit IO acount"
#define IO_KEY       "Your IO key from your Adafruit IO acount"


/******************************* WIFI **************************************/

// the AdafruitIO_WiFi client will work with the following boards:
//   - HUZZAH ESP8266 Breakout -> https://www.adafruit.com/products/2471
//   - Feather HUZZAH ESP8266 -> https://www.adafruit.com/products/2821
//   - Feather HUZZAH ESP32 -> https://www.adafruit.com/product/3405
//   - Feather M0 WiFi -> https://www.adafruit.com/products/3010
//   - Feather WICED -> https://www.adafruit.com/products/3056
//#define WIFI_SSID       "Strater_Guest"
//#define WIFI_PASS       "Strater1296"

#define WIFI_SSID       "Username"
#define WIFI_PASS       "Password"



// comment out the following two lines if you are using fona or ethernet
#include "AdafruitIO_WiFi.h"
AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS);


/******************************* FONA **************************************/

// the AdafruitIO_FONA client will work with the following boards:
//   - Feather 32u4 FONA -> https://www.adafruit.com/product/3027

// uncomment the following two lines for 32u4 FONA,
// and comment out the AdafruitIO_WiFi client in the WIFI section
// #include "AdafruitIO_FONA.h"
// AdafruitIO_FONA io(IO_USERNAME, IO_KEY);


/**************************** ETHERNET ************************************/

// the AdafruitIO_Ethernet client will work with the following boards:
//   - Ethernet FeatherWing -> https://www.adafruit.com/products/3201

// uncomment the following two lines for ethernet,
// and comment out the AdafruitIO_WiFi client in the WIFI section
// #include "AdafruitIO_Ethernet.h"
// AdafruitIO_Ethernet io(IO_USERNAME, IO_KEY);

Credits

Electronic_Chicken_of_Doom
0 projects • 0 followers
Contact
SpaceGodzilla123
0 projects • 0 followers
Contact

Comments

Please log in or sign up to comment.