Raspberry Pi Pico Contest - Share Project to Get a New One for Free Call for pcb design tutorials - Learn the basics of PCBs and the information needed to get started designing your first PCB
VOTE NOW!
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
Design 1/4
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
Usability 2/4
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
Creativity 3/4
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
Content 4/4

Everything is explain in my humourous youtube video. I didn't use a rasberry pi for this project because I don't own any rasberry pi unfortunately.


For one of my future video, I want to do a punching bag that block you attacks and that throws back a punch (It's kinda funny and it looks fun to build). To make this project possible, I need a rasberry pi to use computer vision in my project.


Unfortunately, I am a full time student and I don't have a job so I hope I'll win a rasberry pi 4 since it has much higher performance that the board I used for this video.


Here's the code:

#define PB_PIN 2
#define J_PIN 21
#define BUTTON 3
#define MIN_DELAY 400


int buttonState = 0;
boolean PB_Shot = false;


void setup() 
{
  pinMode(PB_PIN, OUTPUT);
  pinMode(J_PIN, OUTPUT);
  pinMode(BUTTON, INPUT_PULLUP);
}


void loop() {
  buttonState = digitalRead(BUTTON);
  
  if (buttonState == HIGH) {
    if(PB_Shot){
      PB_Shot = false; 
      shootJelly();
    }else{
      PB_Shot = true; 
      shootPeanutButter();
    }
    delay(MIN_DELAY*1.5);
  }
}


void shootPeanutButter(){
  digitalWrite(PB_PIN, HIGH);
  delay(MIN_DELAY);
  digitalWrite(PB_PIN, LOW);
}


void shootJelly(){
  digitalWrite(J_PIN, HIGH);
  delay(MIN_DELAY);
  digitalWrite(J_PIN, LOW);
}


and the schematics looks like that:



Thank you for your time,

Jeff Robin



May 05,2021
141 viewsReport item
  • Comments(0)
  • Likes(0)
You can only upload 1 files in total. Each file cannot exceed 2MB. Supports JPG, JPEG, GIF, PNG, BMP
    View More