Browse Source

Renaming / Refactoring

master
BinHong Lee 7 years ago
parent
commit
e14f03f929
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      main.c

+ 4
- 4
main.c View File

@@ -5,8 +5,8 @@
#include <wiringPiI2C.h> #include <wiringPiI2C.h>


//Preset information about MPU3050 (gyro sensor) //Preset information about MPU3050 (gyro sensor)
#define MPU3050_I2C (0x69)
#define MPU3050_REG (0x21)
#define GYRO_I2C (0x69)
#define GYRO_REG (0x21)


//Preset buzzer WiringPi port //Preset buzzer WiringPi port
#define BUZZER 0 #define BUZZER 0
@@ -71,7 +71,7 @@ int main()


//Setup ISR (button) and I2C (gyro sensor) //Setup ISR (button) and I2C (gyro sensor)
int isrSetup = wiringPiISR(BUTTON, INT_EDGE_FALLING, &buttonInterrupt); int isrSetup = wiringPiISR(BUTTON, INT_EDGE_FALLING, &buttonInterrupt);
int i2cSetup = wiringPiI2CSetup(MPU3050_I2C);
int i2cSetup = wiringPiI2CSetup(GYRO_I2C);


//Check if setups are successful //Check if setups are successful
if (i2cSetup < 0||isrSetup < 0) if (i2cSetup < 0||isrSetup < 0)
@@ -96,7 +96,7 @@ int main()
while (1) while (1)
{ {
//Get gyro sensor input //Get gyro sensor input
gyroInput = wiringPiI2CReadReg8(i2cSetup, MPU3050_REG);
gyroInput = wiringPiI2CReadReg8(i2cSetup, GYRO_REG);


if (gyroInput == 0) if (gyroInput == 0)
{ {


Loading…
Cancel
Save