Published

# Summer Bridge AEG

I am a student participating in CNM's Summer Bridge program. I learned how to code and applied it to building a board.

BeginnerFull instructions provided22

## Things used in this project

### Hardware components

 Particle Argon
×1
 Seeed Studio Base Shield V2
×1
 Seeed Studio Grove - Light Sensor
×1
 Seeed Studio Grove - 6-Axis Accelerometer&Gyroscope
×1
 Seeed Studio Grove - Temperature & Humidity Sensor
×1
 Adafruit NeoPixel Ring: WS2812 5050 RGB LED
×1

### Software apps and online services

 Microsoft VS Code

## Code

### Motion

C/C++
```/*
* Project Motion
* Description: Learn to use accelerometer
* Author:
* Date:
*/

#include "math.h"

float aroll;
float apitch;
int x, y, z;
float ax, ay, az;
int pitch;
int roll;

SYSTEM_MODE(SEMI_AUTOMATIC);

void setup() {
Serial.begin(9600);
}

void loop() {
//read the accelerometer values and store them in variables  x,y,z
Serial.printf("values of X = %i, Y = %i, Z = %i\n",x,y,z);

// Get acceleration in g's
double xyz[3];
ax = xyz[0];
ay = xyz[1];
az = xyz[2];
Serial.printf("values of X = %0.2f, Y = %0.2f, Z = %0.2f,pitch = %0.2f, roll = % 0.2f\n",ax,ay,az,apitch,aroll);
apitch= asin(ax) * (360/(2*M_PI));
aroll= atan2(ay,az)*(360/(2*M_PI));
delay(500);

}
```

### Neopixel

C/C++
```/*
* Project neo_ino
* Description:
* Author:
* Date:
*/

#include "neopixel.h"
#include "colors.h"
#include "math.h"

#define PIXEL_PIN A2
#define PIXEL_COUNT 16
#define PIXEL_TYPE WS2812B

Adafruit_NeoPixel pixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);
int i,pixelNum,color;
bool buttonState;
float bright, t, freq;

SYSTEM_MODE(SEMI_AUTOMATIC);

// setup() runs once, when the device is first turned on.
void setup() {
// Put initialization like pinMode and begin functions here.
pinMode(D10,INPUT);
freq = 1/3;

pixel.begin();
pixel.setPixelColor(5,red);
pixel.setPixelColor(6,orange);
pixel.setPixelColor(7,yellow);
pixel.setPixelColor(8,magenta);
pixel.setPixelColor(9,green);
pixel.setPixelColor(10,orange);

pixel.show();
i = 0;
}

// loop() runs over and over again, as quickly as it can execute.
void loop() {
// The core of your code will likely live here.

while(buttonState == true) {
t = millis() / 1000.0;
bright = 127.5 * sin(2 * M_PI * freq * t) + 127.5;
pixel.setBrightness(25);
i++;
pixelNum = i % 14;
color = i % 6;
pixel.setPixelColor(pixelNum,rainbow[color]);
pixel.show();
delay(10);
}

}
```

## Credits

### Asher Garcia

1 project • 3 followers