Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "I2Cdev.h"
- #include "MPU6050.h"
- #if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
- #include "Wire.h"
- #endif
- MPU6050 accelgyro;
- int16_t ax, ay, az;
- int16_t gx, gy, gz;
- const int buzzer = 3; //buzzer to arduino pin 9
- #define OUTPUT_READABLE_ACCELGYRO
- #define LED_PIN 13
- bool blinkState = false;
- //hey jew boy this is where im defining all the values
- short count = 0;
- bool debounce = false;
- int ticker = 0;
- byte jewishzach = 0;
- void setup() {
- #if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
- Wire.begin();
- #elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE
- Fastwire::setup(400, true);
- #endif
- Serial.begin(38400);
- pinMode(LED_PIN, OUTPUT);
- pinMode(buzzer, OUTPUT); // Set buzzer - pin 9 as an output
- }
- void loop() {
- delay(10);
- accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
- ticker++;
- if (ay > 20000 && debounce == false) {
- count++;
- debounce = true;
- ticker = ticker + 200;
- tone(buzzer, 2000); // Send 0.5KHz sound signal...
- delay(200);
- noTone(buzzer); // Stop sound...
- debounce = false;
- Serial.println(count);
- }
- if (ticker >= 3000) {
- ticker = 0;
- if (count < 58) {
- for(jewishzach=1; jewishzach<13; jewishzach++){
- tone(buzzer, 1000); // Send 1KHz sound signal...
- delay(375); // zach is a queer...
- noTone(buzzer); // Stop sound...
- delay(375); // ...jewish also...
- }
- count = 0;
- }
- }
- #ifdef OUTPUT_READABLE_ACCELGYRO
- #endif
- #ifdef OUTPUT_BINARY_ACCELGYRO
- Serial.write((uint8_t)(ax >> 8)); Serial.write((uint8_t)(ax & 0xFF));
- Serial.write((uint8_t)(ay >> 8)); Serial.write((uint8_t)(ay & 0xFF));
- Serial.write((uint8_t)(az >> 8)); Serial.write((uint8_t)(az & 0xFF));
- Serial.write((uint8_t)(gx >> 8)); Serial.write((uint8_t)(gx & 0xFF));
- Serial.write((uint8_t)(gy >> 8)); Serial.write((uint8_t)(gy & 0xFF));
- Serial.write((uint8_t)(gz >> 8)); Serial.write((uint8_t)(gz & 0xFF));
- #endif
- blinkState = !blinkState;
- digitalWrite(LED_PIN, blinkState);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement