Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edits to EduMKII BP Examples #849

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ const int greenLED= 38;// assign green LED to Pin #10
const int blueLED= 37; // assign blueLED to Pin #12

void setup() {
// By default MSP432 has analogRead() set to 10 bits.
// This Sketch assumes 12 bits. Uncomment to line below to set analogRead()
// to 12 bit resolution for MSP432.
//analogReadResolution(12);
analogReadResolution(12); //added to ensure a 12 bit analog read resolution
Serial.begin(9600); // initialize for sending diagnostic info to computer
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@ const int zpin = 25; // z-axis (only on 3-axis models)

void setup()
{
// By default MSP432 has analogRead() set to 10 bits.
// This Sketch assumes 12 bits. Uncomment to line below to set analogRead()
// to 12 bit resolution for MSP432.
//analogReadResolution(12);
analogReadResolution(12); //added to ensure a 12 bit analog read resolution

// initialize the serial communications:
Serial.begin(9600);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@



#include "pitches.h"
#include <itoa.h>
#include <Wire.h>
#include <Adafruit_TMP006.h>
//#include "OPT3001.h"
#include "OPT3001.h"
#define USE_USCI_B1
#define USING_MSP430F5529_LAUNCHPAD
//#define USING_TIVA_C_LAUNCHPAD
Expand Down Expand Up @@ -281,7 +283,7 @@ float tempReading = 0;
#define NOTE_C4_1 260

// OPT3001
//opt3001 opt3001;
opt3001 opt3001;
Adafruit_TMP006 tmp006;
unsigned long readings = 0;

Expand All @@ -302,6 +304,7 @@ int noteDurations[] = {
void setup()
{
// put your setup code here, to run once:
analogReadResolution(12); //added for the MSP432 to change resolution from the default
Serial.begin(115200);
delay(300);
pinMode(SEL, INPUT);
Expand All @@ -311,7 +314,7 @@ void setup()
Serial.println("Welcome to the Educational BoosterPack MKII Production Test:");

tmp006.begin(TMP006_CFG_8SAMPLE); // Takes 8 averaged samples for measurement
// opt3001.begin();
opt3001.begin();
}

char *ftoa(char *a, float f, int precision)
Expand Down Expand Up @@ -369,23 +372,23 @@ void loop()
colour = redColour;

myScreen.setOrientation(i);
myScreen.setFontSize(2);
myScreen.setFontSize(1);




//Test out the joystick
myScreen.gText(0, 0, " JoyStick Test", blueColour);
myScreen.gText(0, 15, "Right", colour);
while(analogRead(JOY_X)<4094);
while(analogRead(JOY_X)<4085);

myScreen.gText(50,15, " > Passed!", colour);
myScreen.gText(0, 30, "Left", colour);
while(analogRead(JOY_X)>0);
myScreen.gText(50,30, " > Passed!", colour);

myScreen.gText(0, 45, "Up", colour);
while(analogRead(JOY_Y)<4094);
while(analogRead(JOY_Y)<4085);
myScreen.gText(50,45, " > Passed!", colour);

myScreen.gText(0, 60, "Down", colour);
Expand Down Expand Up @@ -482,19 +485,23 @@ void loop()
myScreen.gText(0,0, " TMP006 Test", blueColour);
myScreen.gText(0,20, (char*)tempText , colour);
myScreen.gText(60,20, "*C", colour);

myScreen.gText(0,40, " RGB LED Test", blueColour);
myScreen.gText(0,70, "S1 to Finish", colour);
while(digitalRead(SW1) == 1);
myScreen.clear(grayColour);

//TEST OPT3001 LIGHT SENSOR
//To be enabled once OPT3001 is added to future Edu BP MK II Rev.
// Serial.println("Cover the light sensor to test the OPT3001.");
// while(opt3001.readResult() > 30);
// Serial.println("Shine flashlight onto the light sensor ");
// while(opt3001.readResult() < 1000);

// Serial.println("OPT3001 testing successful!");

myScreen.gText(0,0, " OPT3001 Test", blueColour);
myScreen.gText(0,20, "Cover the OPT3001", blueColour);
while(opt3001.readResult() > 30);
myScreen.gText(0,40, "Passed!", redColour);
myScreen.gText(0,60, "Uncover the OPT3001", blueColour);
while(opt3001.readResult() < 50);
myScreen.gText(0,80, "Passed!", redColour);
delay(400);
myScreen.clear(grayColour);
//TEST RGB LED

myScreen.gText(0,20, "RGB LED Test", blueColour);
i = 0;
int brightness = 0;
int fadeAmount = 5;
Expand Down Expand Up @@ -529,9 +536,9 @@ void loop()
// wait for 30 milliseconds to see the dimming effect
delay(10);
}
myScreen.gText(0,70, "S1 to Finish", colour);
myScreen.gText(0,60, "S1 to Finish", colour);
while(digitalRead(SW1) == 1);
myScreen.gText(0,90, "ALL TESTS PASSED", greenColour);
myScreen.gText(0,100, "ALL TESTS PASSED", greenColour);

while(1);
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@



#include "pitches.h"
#include <Wire.h>
#include <Adafruit_TMP006.h>
//#include "OPT3001.h"
#include "OPT3001.h"
#define USE_USCI_B1
#define USING_MSP430F5529_LAUNCHPAD
//#define USING_TIVA_C_LAUNCHPAD
Expand Down Expand Up @@ -280,7 +282,7 @@ float tempReading = 0;
#define NOTE_C4_1 260

// OPT3001
//opt3001 opt3001;
opt3001 opt3001;
Adafruit_TMP006 tmp006;
unsigned long readings = 0;

Expand All @@ -301,6 +303,7 @@ int noteDurations[] = {
void setup()
{
// put your setup code here, to run once:
analogReadResolution(12); //added to ensure a 12 bit analog read resolution
Serial.begin(115200);
delay(300);
pinMode(SEL, INPUT);
Expand All @@ -310,7 +313,7 @@ void setup()
Serial.println("Welcome to the Educational BoosterPack MKII Production Test:");

tmp006.begin(TMP006_CFG_8SAMPLE); // Takes 8 averaged samples for measurement
// opt3001.begin();
opt3001.begin();
}


Expand All @@ -322,13 +325,13 @@ void loop()

//Test out the joystick
Serial.print("Push joystick all the way to the right.");
while(analogRead(JOY_X)<4094);
while(analogRead(JOY_X)<4085);
Serial.println(" > Passed!");
Serial.print("Push joystick all the way to the left.");
while(analogRead(JOY_X)>0);
Serial.println(" > Passed!");
Serial.print("Push joystick all the way to the top.");
while(analogRead(JOY_Y)<4094);
while(analogRead(JOY_Y)<4085);
Serial.println(" > Passed!");
Serial.print("Push joystick all the way to the bottom.");
while(analogRead(JOY_Y)>0);
Expand Down Expand Up @@ -426,12 +429,12 @@ void loop()

//TEST OPT3001 LIGHT SENSOR
//To be enabled once OPT3001 is added to future Edu BP MK II Rev.
// Serial.println("Cover the light sensor to test the OPT3001.");
// while(opt3001.readResult() > 30);
// Serial.println("Shine flashlight onto the light sensor ");
// while(opt3001.readResult() < 1000);
Serial.println("Cover the light sensor to test the OPT3001.");
while(opt3001.readResult() > 30);
Serial.println("Uncover the light sensor ");
while(opt3001.readResult() < 50);

// Serial.println("OPT3001 testing successful!");
Serial.println("OPT3001 testing successful!");

//TEST RGB LED
Serial.println("Press SW1 to test the RGB LED.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
http://boosterpackdepot.info/wiki/index.php?title=Educational_BoosterPack_MK_II

Turn anything into an input using the Gator Holes. Connect the
the two Gator Holes with anything conductive (e.g. your hand, a fruit,
the two Gator Holes with anything conductive (e.g. a wire, a fruit,
orange juice, coffee, etc.) to sound the Buzzer.

Dec 2013 - Modified for Educational BoosterPack MK II
Expand All @@ -22,7 +22,6 @@ http://boosterpackdepot.info/wiki/index.php?title=Educational_BoosterPack_MK_II


*/

const int gatorHole = 34; // the number of the gator hole pin
const int buzzerPin = 40;

Expand All @@ -33,15 +32,13 @@ void setup() {

// initialize the gator hole pin as an input:
pinMode(gatorHole, INPUT_PULLUP);

}

void loop(){
// read the state of the pushbutton value:
// read the state of the gator hole
gatorHoleState = digitalRead(gatorHole);

// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
// check if the gatorholes are connected.
// if it is, the gatorHoleState is LOW:
if (gatorHoleState == LOW) {
// turn on Buzzer
tone(buzzerPin, 500, 500);
Expand All @@ -50,5 +47,5 @@ void loop(){
// turn off Buzzer
noTone(buzzerPin);
}

delay(5);
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ byte drawColor = 0;
boolean lastCycleState = true;

void setup() {
// By default MSP432 has analogRead() set to 10 bits.
// This Sketch assumes 12 bits. Uncomment to line below to set analogRead()
// to 12 bit resolution for MSP432.
//analogReadResolution(12);

analogReadResolution(12); //added to ensure a 12 bit analog read resolution

//Start Serial communication
Serial.begin(9600);

pinMode(drawButton, INPUT_PULLUP);
pinMode(32,INPUT_PULLUP);
pinMode(33,INPUT_PULLUP);
//Initialize myScreen
myScreen.begin();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ int joystickXState, joystickYState ;
void setup() {


// By default MSP432 has analogRead() set to 10 bits.
// This Sketch assumes 12 bits. Uncomment to line below to set analogRead()
// to 12 bit resolution for MSP432.
//analogReadResolution(12);
analogReadResolution(12); //added to ensure a 12 bit analog read resolution

// initialize the pushbutton pin as an input:
pinMode(joystickSel, INPUT_PULLUP);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ int pressedStart(void);
void setup()
{
// put your setup code here, to run once:
analogReadResolution(12); //added to ensure a 12 bit analog read resolution
statemachine =0;
pinMode(BUTTON_B, INPUT);
pinMode(BUTTON_A, INPUT);
Expand Down Expand Up @@ -135,16 +136,15 @@ void loop()
break;

//---BUTTON_B---
case 8: // Waiting for Right
delay(300);
case 8: // Waiting for buttonB
if (pressedB()) //Button B
statemachine++;
else
statemachine = 0;
break;

//---BUTTON_A---
case 9: // Waiting for Right
case 9: // Waiting for buttonA
if (pressedA()) //Button A
statemachine++;
else
Expand Down Expand Up @@ -180,7 +180,7 @@ int pressedLeft(void)
(digitalRead(JOY_SEL) == 0) )
pass = 0;

if ( (analogRead(JOY_Y)<10) || (analogRead(JOY_Y) > 4050) )
if ( (analogRead(JOY_Y)<10) || (analogRead(JOY_Y) > 4050) || (analogRead(JOY_X) > 4085) )
pass = 0;

}
Expand All @@ -189,15 +189,15 @@ int pressedLeft(void)
int pressedRight(void)
{
uint8_t pass = 1;
while ( (analogRead(JOY_X)<4094) && (pass==1))
while ( (analogRead(JOY_X)<4085) && (pass==1))
{
// Ensure no other buttons/joystick directions are pressed
if ( (digitalRead(BUTTON_A) == 0) ||
(digitalRead(BUTTON_B) == 0) ||
(digitalRead(JOY_SEL) == 0) )
pass = 0;

if ( (analogRead(JOY_Y)<10) || (analogRead(JOY_Y) > 4050) )
if ( (analogRead(JOY_Y)<10) || (analogRead(JOY_Y) > 4050) || (analogRead(JOY_X) < 10) )
pass = 0;

}
Expand All @@ -216,7 +216,7 @@ int pressedDown(void)
(digitalRead(JOY_SEL) == 0) )
pass = 0;

if ( (analogRead(JOY_X)<10) || (analogRead(JOY_X) > 4050) )
if ( (analogRead(JOY_X)<10) || (analogRead(JOY_X) > 4050) || (analogRead(JOY_Y) > 4085) )
pass = 0;

}
Expand All @@ -225,15 +225,15 @@ int pressedDown(void)
int pressedUp(void)
{
uint8_t pass = 1;
while ( (analogRead(JOY_Y)<4094) && (pass==1))
while ( (analogRead(JOY_Y)<4085) && (pass==1))
{
// Ensure no other buttons/joystick directions are pressed
if ( (digitalRead(BUTTON_A) == 0) ||
(digitalRead(BUTTON_B) == 0) ||
(digitalRead(JOY_SEL) == 0) )
pass = 0;

if ( (analogRead(JOY_X)<10) || (analogRead(JOY_X) > 4050) )
if ( (analogRead(JOY_X)<10) || (analogRead(JOY_X) > 4050) || (analogRead(JOY_Y) < 10) )
pass = 0;

}
Expand Down
Loading