Jump to content

My dad wanted me to make a ClickBot for his game so he doesn't get attacked (Really dad -.-), so I wrote up a program for this on my Arduino Leonardo and littleBits but the code isn't working. Nothing outputs and it always shuts off (You'll know what I mean when you see the code). Any tips?

  const int buttonPin = 0 ;  const int dimmerPin = A0 ;  const int dimmerPin2 = A1 ;  const int buzzerPin = 5 ;  const int bargraphPin = 1 ;  const int motorPin = 9 ;  int dimmerPinV = 0 ;  int dimmerPin2V = 0 ;  int motorTime = 0 ;  int buttonState = 0 ;  int buttonPushCounter = 0 ;  int lastButtonState = 0 ;     void setup() {  Serial.begin(9600) ;  pinMode(buttonPin, INPUT) ;  pinMode(bargraphPin, OUTPUT) ;  pinMode(buzzerPin, OUTPUT) ;  pinMode(motorPin, OUTPUT) ;}void loop() {  dimmerPinV = digitalRead(dimmerPin) ;  dimmerPin2V=digitalRead(dimmerPin2) ;  buttonState = digitalRead(buttonPin) ;  motorTime = digitalRead(dimmerPinV) ;  digitalWrite(bargraphPin, motorTime) ;    if (buttonState != lastButtonState) {        if (buttonState == HIGH) {      buttonPushCounter++ ;      Serial.println("ClickBot is on!") ;          }    else {      Serial.println("Cickbot is off!") ;    }  }   if (buttonPushCounter % 2 == 0 ) { digitalWrite(motorPin, dimmerPin2V) ; delay(dimmerPinV) ; digitalWrite(motorPin, LOW) ; delay(500) ;   digitalWrite(buzzerPin, HIGH) ;   delay(2000) ;   digitalWrite(buzzerPin, LOW) ;   }   else {    digitalWrite(motorPin, LOW) ;    digitalWrite(buzzerPin, LOW) ;   }   lastButtonState = buttonState ;   delay(1) ; }

Thanks

He who asks is stupid for 5 minutes. He who does not ask, remains stupid. -Chinese proverb. 

Those who know much are aware that they know little. - Slick roasting me

Spoiler

AXIOM

CPU- Intel i5-6500 GPU- EVGA 1060 6GB Motherboard- Gigabyte GA-H170-D3H RAM- 8GB HyperX DDR4-2133 PSU- EVGA GQ 650w HDD- OEM 750GB Seagate Case- NZXT S340 Mouse- Logitech Gaming g402 Keyboard-  Azio MGK1 Headset- HyperX Cloud Core

Offical first poster LTT V2.0

 

Link to comment
https://linustechtips.com/topic/500482-arduino-clickbot/
Share on other sites

Link to post
Share on other sites

It's littleBits, they all run on 1 9V battery, I've done projects that hog much more energy but still work. I'm using the littleBits Arduino and Basic kit

He who asks is stupid for 5 minutes. He who does not ask, remains stupid. -Chinese proverb. 

Those who know much are aware that they know little. - Slick roasting me

Spoiler

AXIOM

CPU- Intel i5-6500 GPU- EVGA 1060 6GB Motherboard- Gigabyte GA-H170-D3H RAM- 8GB HyperX DDR4-2133 PSU- EVGA GQ 650w HDD- OEM 750GB Seagate Case- NZXT S340 Mouse- Logitech Gaming g402 Keyboard-  Azio MGK1 Headset- HyperX Cloud Core

Offical first poster LTT V2.0

 

Link to comment
https://linustechtips.com/topic/500482-arduino-clickbot/#findComment-6683265
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×