Published

# Summer Bridge AIB

I am a CNM student who has participated in the STEM Core summer program. This is my project while in the course.

BeginnerShowcase (no instructions)38

## 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 - CO2 & Temperature & Humidity Sensor (SCD30)
×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:
*/

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

SYSTEM_MODE(SEMI_AUTOMATIC);

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

void loop() {
//read the accelerometer values and store them in variables  x,y,z
adxl.readXYZ(&x, &y, &z); //tell it to put data into x,y,z from reality
Serial.printf("values of X = %i, Y = %i, Z = %i\n",x,y,z); //print along the usb cable

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

}
```

### Neopixel

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

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

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

int i, pixelNum, color;
bool buttonState; //gives a variable that can be on or off
float bright, t, freq; //brightness, time, frequency (occilation)

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); //we've got a button attached
freq = 1/3.0; //interger divided by interger is integer (would actually equal zero)
pixel.begin();
pixel.setPixelColor(5,red);
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.

buttonState = digitalRead(D10); //whatever the button actually is, T(Pressed) or F(not Pressed)
while(buttonState == true) {
t = millis() / 1000.0;
bright = 127.5 * sin(2 * M_PI * freq *t) + 127.5; //Trig equation
pixel.setBrightness(bright);
i++;
pixelNum = i % 14;
color = i % 6;
pixel.setPixelColor(pixelNum,rainbow[color]);
pixel.show();
delay(25);