• Home
  • 2017
  • 2016
  • 2015
  • 2014
  • 2013
  • 2012
  • 2011

PDI Studio 5

Design to make a difference

Feed on
Posts
comments

Source Code–Please Use

Dec 4th, 2013 by bernsj2

An Open-Source Philosophy

The philosophy behind Fraction Bot is that learning tools should be universal. We recognize that instructors of all kinds are often under-funded for their own classroom supplies, so we try to accommodate school budgets by providing the code used by Fraction Bot at no cost. Should an instructor have access to other supplies that would enable him/her to create a new version of the Fraction Bot, we welcome adaptations of the code to suit what ever needs arise. The following code pertains to an Arduino Uno microcontroller.

 

Code:

//Coded by Jason King PDI Studio 5 Fall 2013
//Fraction Bot
//JAson King, Krist Glanville, Joe Bernstein

#include <SoftwareSerial.h>
#include <serialGLCD.h> // Include the library
#include <ShiftPWM.h>

SoftwareSerial mySerial(1, 0); // RX, TX
const int ShiftPWM_latchPin=8;
const int ShiftPWM_dataPin = 11;
const int ShiftPWM_clockPin = 13;
const bool ShiftPWM_invertOutputs = false;
const bool ShiftPWM_balanceLoad = false;
unsigned char maxBrightness = 255;
unsigned char pwmFrequency = 75;
int numRegisters = 2;
int numRGBleds = numRegisters*8/3;
int Rled = 8;
int Gled = 9;
int Bled = 10;
int Rled2 = 11;
int Gled2 = 12;
int Bled2 = 13;
float DB1 = 0;
float DB2 = 0;
float DB3 = 0;
int DB4 = 0;
float N1 = 0;
float N2 = 0;
float D1 = 0;
float D2 = 0;
float N3 = 0;
float D3 = 0;
float N4 = 0;
float D4 = 0;
float N5 = 0;
float D5 = 0;
char Mod = 0;
int Calc = 0;
int CalcH = 0;
int i = 0;
byte Hint = 0;
byte reduce = 0;
char Operator;
byte Solve = 0;
byte next = 0;
int Mixed = 0;
int Mixedcheck = 0;
int Level = 1;
int SelE = 0;
int right = 0;
//int wrong = 0;
int sensorPin = A3;
int Pot = 0;
const int SetButton = 4;
const int HelpButton = 5;
const int CycButton = 3;
const int AddButton = 6;
int Cyc = 0;
byte Loop = 0;

void setup()
{
Serial.begin(115200);
mySerial.begin(115200);
pinMode(SetButton, INPUT);
pinMode(HelpButton, INPUT);
pinMode(CycButton, INPUT);
pinMode(Rled, OUTPUT);
pinMode(Gled, OUTPUT);
pinMode(Bled, OUTPUT);
pinMode(Rled2, OUTPUT);
pinMode(Gled2, OUTPUT);
pinMode(Bled2, OUTPUT);
}
serialGLCD lcd;

void loop()
{
delay(1000);
int rst = 1;
lcd.clearLCD();
lcd.gotoLine(3);
delay(300);
lcd.toggleFont();
Serial.print(“FractionBot”);
lcd.gotoLine(5);
delay(50);
lcd.toggleFont();
Serial.print(” PDI Studio 5″);
lcd.gotoLine(7);
Serial.print(” JMAK & KDAWG & Joe”);
delay(1000);
while (rst ==1)
{
Loop = 0;
Randomize();
delay(500);
Equation();
delay(500);
Calculate();
delay(500);
Reduce();
delay(500);
// lcd.toggleFont();
delay(50);
while (Loop == 0)
{
while(digitalRead(SetButton) == LOW && digitalRead(HelpButton) == LOW)
{
SetAnswer();
delay(150);
if (digitalRead(CycButton) == HIGH)
{
DB3++;
for(DB3; DB3 > 1; DB3++)
{
Cyc++;
DB3 = 0;
}
}
LCDprint();
delay(5);
}
if (digitalRead(SetButton) == HIGH)
{
DB1++;
for(DB1; DB1 > 2; DB1++)
{
Check();
delay(50);
DB1=0;
}
}
if (digitalRead(HelpButton) == HIGH)
{
DB2++;
for(DB2; DB2 > 2; DB2++)
{
Help();
delay(50);
DB2=0;
}
}
}
}
}
void Randomize()
{
digitalWrite(Rled, HIGH);
digitalWrite(Rled2, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(Rled, LOW);
digitalWrite(Rled2, LOW);
digitalWrite(Bled, HIGH);
digitalWrite(Bled2, HIGH); // turn the LED off by making the voltage LOW
delay(100);
digitalWrite(Bled, LOW);
digitalWrite(Bled2, LOW);
digitalWrite(Gled, HIGH);
digitalWrite(Gled2, HIGH);
delay(100);
digitalWrite(Rled, HIGH);
digitalWrite(Rled2, HIGH);
digitalWrite(Gled, LOW);
digitalWrite(Gled2, LOW); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(Rled, LOW);
digitalWrite(Rled2, LOW);
digitalWrite(Bled, HIGH);
digitalWrite(Bled2, HIGH); // turn the LED off by making the voltage LOW
delay(100);
digitalWrite(Bled, LOW);
digitalWrite(Bled2, LOW);
digitalWrite(Gled, HIGH);
digitalWrite(Gled2, HIGH);
delay(100);
digitalWrite(Gled, LOW);
digitalWrite(Gled2, LOW);
digitalWrite(Rled, HIGH);
digitalWrite(Rled2, HIGH); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(Rled, LOW);
digitalWrite(Rled2, LOW);
digitalWrite(Bled, HIGH);
digitalWrite(Bled2, HIGH); // turn the LED off by making the voltage LOW
delay(100);
digitalWrite(Bled, LOW);
digitalWrite(Bled2, LOW);
digitalWrite(Gled, HIGH);
digitalWrite(Gled2, HIGH);
delay(100);
digitalWrite(Rled, HIGH);
digitalWrite(Rled2, HIGH);
digitalWrite(Gled, LOW);
digitalWrite(Gled2, LOW); // turn the LED on (HIGH is the voltage level)
delay(100); // wait for a second
digitalWrite(Rled, LOW);
digitalWrite(Rled2, LOW);
digitalWrite(Bled, HIGH);
digitalWrite(Bled2, HIGH); // turn the LED off by making the voltage LOW
delay(100);
digitalWrite(Bled, LOW);
digitalWrite(Bled2, LOW);
digitalWrite(Gled, HIGH);
digitalWrite(Gled2, HIGH);
delay(100);
digitalWrite(Gled, LOW);
digitalWrite(Gled2, LOW);
//Serial.println(“Random”);
if (Level == 1)
{
N1 = random(1,3);
N2 = random(1,3);
D1 = random(1,4);
D2 = random(1,4);
SelE = 1;
//Serial.println(“Random Level 1”);
//j++;
}

if (Level == 2)
{
N1 = random(1,5);
N2 = random(1,3);
D1 = random(1,6);
D2 = random(1,5);
SelE = random(1,2);
//Serial.println(“Random Level 2”);
}

if (Level == 3)
{
N1 = random(1,7);
N2 = random(1,7);
D1 = random(1,8);
D2 = random(1,8);
SelE = random(1,3);
//Serial.println(“Random Level 3”);
}
if (Level == 4)
{
N1 = random(1,5);
N2 = random(1,5);
D1 = random(1,5);
D2 = random(1,5);
SelE = random(1,4);
//Serial.println(“Random Level 4”);
}
}

void Equation()
{
Hint=0;
if (SelE == 1)
{
Calc = 1;
CalcH = 1;
Operator = ‘X’;
}
if (SelE == 2)
{
Operator = ‘/’;
Calc = 2;
CalcH = 2;
}
if (SelE == 3)
{
Operator = ‘+’;
Calc = 3;
CalcH = 3;
}
if (SelE == 4)
{
Operator = ‘-‘;
Calc = 4;
CalcH = 4;
}
}

void Calculate()
{
Solve = 1;
next = 1;
if (Calc == 1)
{
N3 = (N1*N2);
D3 = (D1*D2);
}
if (Calc == 2)
{
N3 = (N1*D2);
D3 = (D1*N2);
}
if (Calc == 3)
{
N1 = (N1*D2);
N2 = (N2*D1);
D3 = (D1*D2);
N3 = (N1 + N2);
}
if (Calc == 4)
{
N1 = (N1*D2);
N2 = (N2*D1);
D3 = (D1*D2);
N3 = (N1 – N2);
}
}

void Reduce()
{
reduce = 1;
int j = 0;
while (j==0)
{
if (abs(D3/5) == 1 || abs(D3/5) == 2 || abs(D3/5) == 3 || abs(D3/5) == 4 || abs(D3/5) == 5)
{
if (abs(N3/5) == 1 || abs(N3/5) == 2 || abs(N3/5) == 3 || abs(N3/5) == 4 || abs(N3/5) == 5)
{
N4 = N3/5;
D4 = D3/5;
j=1;
}
}
if (abs(D3/4) == 1.00 || abs(D3/4) == 2.00 || abs(D3/4) == 3 || abs(D3/4) == 4 || abs(D3/4) == 5)
{
if (abs(N3/4) == 1.00 || abs(N3/4) == 2.00 || abs(N3/4) == 3 || abs(N3/4) == 4 || abs(N3/4) == 5)
{
N4 = N3/4;
D4 = D3/4;
j=1;
}
}
if (abs(D3/3) == 1 || abs(D3/3) == 2 || abs(D3/3) == 3 || abs(D3/3) == 4 || abs(D3/3) == 5)
{
if (abs(N3/3) == 1 || abs(N3/3) == 2 || abs(N3/3) == 3 || abs(N3/3) == 4 || abs(N3/3) == 5)
{
N4 = N3/3;
D4 = D3/3;
j=1;
}
}
if (abs(D3/2) == 1 || abs(D3/2) == 2 || abs(D3/2) == 3 || abs(D3/2) == 4 || abs(D3/2) == 5 || abs(D3/2) == 6 || abs(D3/2) == 7 || abs(D3/2) == 8)
{
if (abs(N3/2) == 1 || abs(N3/2) == 2 || abs(N3/2) == 3 || abs(N3/2) == 4 || abs(N3/2) == 5 || abs(N3/2) == 6 || abs(N3/2) == 7 || abs(N3/2) == 8 || abs(N3/2) == 9 || abs(N3/2) == 10)
{
N4 = N3/2;
D4 = D3/2;
j=1;
}
}
else
{
N4 = N3;
D4 = D3;
j=1;
}
}
if (N4 == D4)
{
N4 = 1;
D4 = 1;
}
if (abs(N4/D4) > 1)
{
if (N4/D4 < 2)
{
Mixed =1;
N4 = N4-D4;
//Serial.print(“here”);
}
if (N4/D4 > 2 && N4/D4 < 3)
{
Mixed =2;
N4 = N4-(2*D4);
}
if (N4/D4 > 3 && N4/D4 < 4)
{
Mixed =3;
N4 = N4-(3*D4);
}
if (N4/D4 > 5 && N4/D4 < 6)
{
Mixed =4;
N4 = N4-(4*D4);
}
if (N4/D4 > 7 && N4/D4 < 8)
{
Mixed =5;
N4 = N4-(5*D4);
}
}
}

void SetAnswer()
{
if (Cyc == 0)
{
N5 = 1;
}
if (Cyc == 1)
{
N5 = 2;
}
if (Cyc == 2)
{
N5 = 3;
}
if (Cyc == 3)
{
N5 = 4;
}
if (Cyc == 4)
{
N5 = 5;
}
if (Cyc == 5)
{
N5 = 6;
}
if (Cyc == 6)
{
N5 = 7;
}
if (Cyc == 7)
{
N5 = 8;
}
if (Cyc == 8)
{
N5 = 9;
}
if (Cyc == 9)
{
N5 = 10;
}
if (Cyc == 10)
{
N5 = 11;
}
if (Cyc == 11)
{
N5 = 12;
}
if (Cyc == 12)
{
N5 = 13;
}
if (Cyc == 13)
{
N5 = 14;
}
if (Cyc == 14)
{
Cyc = 0;
}
if (digitalRead(AddButton) == HIGH)
{
DB4++;
for(DB4; DB4 > 2; DB4++)
{
Mixedcheck++;
DB4=0;
}
if (Mixedcheck == 6)
{
Mixedcheck = 0;
}
}

Pot = analogRead(sensorPin);
delay(20);
D5 = map(Pot, 0, 690,20, 0);
}

void Check()
{
Cyc = 0;
lcd.clearLCD();
/* Serial.println(“Check”);
Serial.print(N3);
Serial.print(” “);
Serial.print(N4);
Serial.print(” “);
Serial.println(N5);
Serial.print(D3);
Serial.print(” “);
Serial.print(D4);
Serial.print(” “);
Serial.println(D5);
*/
if (N4 == N5 && D4 == D5 && Mixed == Mixedcheck)
{
right++;
lcd.toggleFont();
lcd.gotoLine(3);
Serial.print(“Correct!!!”);
lcd.gotoLine(5);
Serial.println(“Good Job!”);
digitalWrite(Gled, HIGH);
digitalWrite(Gled2, HIGH);
delay(100);
digitalWrite(Gled, LOW);
digitalWrite(Gled2, LOW);
delay(100);
digitalWrite(Gled, HIGH);
digitalWrite(Gled2, HIGH);
delay(100);
digitalWrite(Gled, LOW);
digitalWrite(Gled2, LOW);
delay(100);
digitalWrite(Gled, HIGH);
digitalWrite(Gled2, HIGH);
delay(100);
digitalWrite(Gled, LOW);
digitalWrite(Gled2, LOW);
delay(100);
digitalWrite(Gled, HIGH);
digitalWrite(Gled2, HIGH);
delay(100);
digitalWrite(Gled, LOW);
digitalWrite(Gled2, LOW);
delay(100);
digitalWrite(Gled, HIGH);
digitalWrite(Gled2, HIGH);
delay(100);
digitalWrite(Gled, LOW);
digitalWrite(Gled2, LOW);
delay(100);
digitalWrite(Gled, HIGH);
digitalWrite(Gled2, HIGH);
delay(100);
digitalWrite(Gled, LOW);
digitalWrite(Gled2, LOW);
delay(100);
digitalWrite(Gled, HIGH);
digitalWrite(Gled2, HIGH);
delay(100);
digitalWrite(Gled, LOW);
digitalWrite(Gled2, LOW);
delay(100);
digitalWrite(Gled, HIGH);
digitalWrite(Gled2, HIGH);
delay(100);
digitalWrite(Gled, LOW);
digitalWrite(Gled2, LOW);
lcd.toggleFont();
Mixedcheck = 0;
Mixed =0;
N3=0;
N4=0;
D3=0;
D4=0;

if (right==5)
{
right = 0;
//Lightcorrect();
Level++;
}
}
else
{
lcd.toggleFont();
lcd.gotoLine(3);
Serial.print(“Incorrect”);
lcd.gotoLine(5);
Serial.print(“Try Again”);
digitalWrite(Rled, HIGH);
digitalWrite(Rled2, HIGH);
delay(100);
digitalWrite(Rled, LOW);
digitalWrite(Rled2, LOW);
delay(100);
digitalWrite(Rled, HIGH);
digitalWrite(Rled2, HIGH);
delay(100);
digitalWrite(Rled, LOW);
digitalWrite(Rled2, LOW);
delay(100);
digitalWrite(Rled, HIGH);
digitalWrite(Rled2, HIGH);
delay(100);
digitalWrite(Rled, LOW);
digitalWrite(Rled2, LOW);
delay(100);
digitalWrite(Rled, HIGH);
digitalWrite(Rled2, HIGH);
delay(100);
digitalWrite(Rled, LOW);
digitalWrite(Rled2, LOW);
delay(100);
digitalWrite(Rled, HIGH);
digitalWrite(Rled2, HIGH);
delay(100);
digitalWrite(Rled, LOW);
digitalWrite(Rled2, LOW);
delay(100);
digitalWrite(Rled, HIGH);
digitalWrite(Rled2, HIGH);
delay(100);
digitalWrite(Rled, LOW);
digitalWrite(Rled2, LOW);
// delay(100);
lcd.toggleFont();
/*lcd.gotoLine(2);
Serial.print(” “);
Serial.print(N4,0);
lcd.gotoLine(3);
Serial.print(Mixed);
Serial.print(“-“);
lcd.gotoLine(4);
Serial.print(” “);
Serial.print(D4,0);
*/
Mixedcheck = 0;
Mixed =0;
N3=0;
N4=0;
D3=0;
D4=0;
}
delay(500);
Loop = 1;
lcd.clearLCD();
}

void LCDprint()
{
//delay(100);
lcd.clearLCD();
//delay(10);
if (SelE == 1)
{
if (Mixedcheck != 0)
{
Serial.print(” Fraction Bot”);
lcd.gotoLine(3);
Serial.print(N1,0);
Serial.print(” “);
Serial.print(N2,0);
Serial.print(” “);
Serial.print(N5,0);
lcd.gotoLine(4);
Serial.print(“- X – = “);
Serial.print(Mixedcheck);
Serial.print(“-“);
lcd.gotoLine(5);
Serial.print(D1,0);
Serial.print(” “);
Serial.print(D2,0);
Serial.print(” “);
Serial.print(D5,0);
lcd.gotoLine(8);
Serial.print(“Level: “);
Serial.print(Level);
Serial.print(” “);
Serial.print(right);
Serial.print(“/5″);
}
else
{
Serial.print(” Fraction Bot”);
lcd.gotoLine(3);
Serial.print(N1,0);
Serial.print(” “);
Serial.print(N2,0);
Serial.print(” “);
Serial.print(N5,0);
lcd.gotoLine(4);
Serial.print(“- X – = -“);
lcd.gotoLine(5);
Serial.print(D1,0);
Serial.print(” “);
Serial.print(D2,0);
Serial.print(” “);
Serial.print(D5,0);
lcd.gotoLine(8);
Serial.print(“Level: “);
Serial.print(Level);
Serial.print(” “);
Serial.print(right);
Serial.print(“/5”);
}
}
if (SelE == 2)
{
Serial.print(“Fraction Bot”);
lcd.gotoLine(3);
Serial.print(N1,0);
Serial.print(” “);
Serial.print(N2,0);
Serial.print(” “);
Serial.print(N5,0);
lcd.gotoLine(4);
Serial.print(“- / – = -“);
lcd.gotoLine(5);
Serial.print(D1,0);
Serial.print(” “);
Serial.print(D2,0);
Serial.print(” “);
Serial.print(D5,0);
lcd.gotoLine(8);
Serial.print(“Level: “);
Serial.print(Level);
Serial.print(” “);
Serial.print(right);
Serial.print(“/5”);
}
if (SelE == 3)
{
Serial.print(“Fraction Bot”);
lcd.gotoLine(3);
Serial.print(N1,0);
Serial.print(” “);
Serial.print(N2,0);
Serial.print(” “);
Serial.print(N5,0);
lcd.gotoLine(4);
Serial.print(“- + – = -“);
lcd.gotoLine(5);
Serial.print(D1,0);
Serial.print(” “);
Serial.print(D2,0);
Serial.print(” “);
Serial.print(D5,0);
lcd.gotoLine(8);
Serial.print(“Level: “);
Serial.print(Level);
Serial.print(” “);
Serial.print(right);
Serial.print(“/5”);

}
if (SelE == 4)
{
Serial.print(“Fraction Bot”);
lcd.gotoLine(3);
Serial.print(N1,0);
Serial.print(” “);
Serial.print(N2,0);
Serial.print(” “);
Serial.print(N5,0);
lcd.gotoLine(4);
Serial.print(“- – – = -“);
lcd.gotoLine(5);
Serial.print(D1,0);
Serial.print(” “);
Serial.print(D2,0);
Serial.print(” “);
Serial.print(D5,0);
lcd.gotoLine(8);
Serial.print(“Level: “);
Serial.print(Level);
Serial.print(” “);
Serial.print(right);
Serial.print(“/5″);
}
}

void Help()
{
Hint++;
// Serial.println(” HELP “);
//Serial.print(“Hint =”);
//Serial.println(Hint);
if (CalcH == 1)
{
//Serial.println(” Multiply “);
if (Hint == 1)
{
lcd.toggleFont();
lcd.clearLCD();
delay(10);
lcd.gotoLine(3);
Serial.print(” Multiply”);
delay(10);
lcd.gotoLine(5);
Serial.print(” Across”);
lcd.toggleFont();
delay(5000);
}
else if (Hint == 2)
{
lcd.toggleFont();
lcd.clearLCD();
delay(25);
lcd.gotoLine(3);
Serial.print(N1,0);
Serial.print(‘X’);
Serial.print(N2,0);
Serial.print(‘=’);
Serial.print(N1*N2,0);
lcd.toggleFont();
delay(5000);
}
else if (Hint == 3)
{
lcd.toggleFont();
lcd.clearLCD();
delay(25);
lcd.gotoLine(5);
Serial.print(D1,0);
Serial.print(‘X’);
Serial.print(D2,0);
Serial.print(‘=’);
Serial.print(D1*D2,0);
lcd.toggleFont();
delay(5000);
}
else if (Hint == 4)
{
Loop=1;
}
DB2 = 0;
}

if (CalcH == 2)
{
//Serial.println(” Divide “);
if (Hint == 1)
{
lcd.toggleFont();
lcd.clearLCD();
delay(25);
Serial.print(“Kentucky Chicken “);
lcd.gotoLine(3);
Serial.print(“Chicken “);
lcd.gotoLine(5);
Serial.print(“Fried”);
lcd.toggleFont();
delay(5000);
}
else if (Hint == 2)
{
lcd.toggleFont();
lcd.clearLCD();
delay(25);
lcd.gotoLine(3);
Serial.print(“Keep Change “);
lcd.gotoLine(5);
Serial.print(” Flip”);
lcd.toggleFont();
delay(5000);
}
else if (Hint ==3)
{
float Temp = N2;
N2 = D2;
D2 = Temp;
Operator = ‘x’;
Calc = 1;
delay(100);
}
else if (Hint == 4)
{
Loop = 1;
}

DB2 = 0;
}
if (Calc == 3)
{
//Serial.println(” ADD “);
if (Hint == 1)
{
lcd.toggleFont();
lcd.clearLCD();
delay(25);
lcd.gotoLine(3);
Serial.print(“Lowest Common “);
lcd.gotoLine(5);
Serial.print(“Denomenator”);
lcd.toggleFont();
delay(5000);
}
else if (Hint == 2)
{
lcd.toggleFont();
lcd.clearLCD();
delay(25);
lcd.gotoLine(2);
Serial.print(“Multiply by “);
lcd.gotoLine(4);
Serial.print(“Opposite”);
lcd.gotoLine(6);
Serial.print(“Denomenator”);
lcd.toggleFont();
delay(5000);
}
else if (Hint == 3)
{
lcd.toggleFont();
lcd.clearLCD();
delay(25);
lcd.gotoLine(4);
Serial.print(‘LCD =’);
Serial.print(D1*D2);
lcd.toggleFont();
delay(5000);
}
else if (Hint == 4)
{
float TempD = D2;
N2 = (N2*D1);
D2 = (D2*D1);
N1 = (TempD*N1);
D1 = (TempD*D1);
}
else if (Hint == 5)
{
Loop = 1;
}
DB2 = 0;
}
if (Calc == 4)
{
Serial.println(” SUBTRACT “);
if (Hint == 1)
{
lcd.toggleFont();
lcd.clearLCD();
delay(25);
lcd.gotoLine(3);
Serial.print(“Lowest Common “);
lcd.gotoLine(5);
Serial.print(“Denomenator”);
lcd.toggleFont();
delay(5000);
}
else if (Hint == 2)
{
lcd.toggleFont();
lcd.clearLCD();
delay(25);
lcd.gotoLine(2);
Serial.print(“Multiply by “);
lcd.gotoLine(4);
Serial.print(“Opposite”);
lcd.gotoLine(6);
Serial.print(“Denomenator”);
lcd.toggleFont();
delay(5000);
}
else if (Hint == 3)
{
lcd.toggleFont();
lcd.clearLCD();
delay(25);
lcd.gotoLine(4);
Serial.print(‘LCD =’);
Serial.print(D1*D2);
lcd.toggleFont();
delay(5000);
}
else if (Hint == 4)
{
float TempD = D2;
N2 = (N2*D1);
D2 = (D2*D1);
N1 = (TempD*N1);
D1 = (TempD*D1);
}
else if (Hint == 5)
{
Loop = 1;
}
DB2 = 0;
}
}

void Lightshow()
{
ShiftPWM.SetAll(0);
// Print information about the interrupt frequency, duration and load on your program
//ShiftPWM.PrintInterruptLoad();
ShiftPWM.SetOne(0,255);
ShiftPWM.SetOne(3,255);
ShiftPWM.SetOne(6,255);
ShiftPWM.SetOne(9,255);
ShiftPWM.SetOne(12,255);
delay(200);
ShiftPWM.SetAll(0);
ShiftPWM.SetOne(1,255);
ShiftPWM.SetOne(4,255);
ShiftPWM.SetOne(7,255);
ShiftPWM.SetOne(10,255);
ShiftPWM.SetOne(13,255);
delay(200);
ShiftPWM.SetAll(0);
ShiftPWM.SetOne(2,255);
ShiftPWM.SetOne(5,255);
ShiftPWM.SetOne(8,255);
ShiftPWM.SetOne(11,255);
ShiftPWM.SetOne(14,255);
delay(200);
}

void Lightwrong()
{
ShiftPWM.SetOne(9,255);
ShiftPWM.SetOne(12,255);
delay(250);
ShiftPWM.SetOne(6,255);
ShiftPWM.SetOne(15,255);
delay(250);
ShiftPWM.SetOne(3,255);
ShiftPWM.SetOne(18,255);
delay(250);
ShiftPWM.SetOne(0,255);
ShiftPWM.SetOne(21,255);
delay(250);
}

void Lightcorrect()
{
ShiftPWM.SetOne(10,255);
ShiftPWM.SetOne(13,255);
delay(250);
ShiftPWM.SetOne(7,255);
ShiftPWM.SetOne(16,255);
delay(250);
ShiftPWM.SetOne(4,255);
ShiftPWM.SetOne(19,255);
delay(250);
ShiftPWM.SetOne(2,255);
ShiftPWM.SetOne(22,255);
delay(250);
}

 

 

 

 

 

Comments Off on Source Code–Please Use



Comments are closed.

  • Projects

    • 2017
      • Artistic Prosthetic
      • Cell Protobox Activity
        • Background
        • Overview and Lesson Plan
        • Pictures from the Activity
        • Final Prototypes from the Activity
        • Recount of the Activity
        • Demo Day with PDI Students
        • Final Protobox
        • Next Steps
        • Vision
      • Hue Harmony
        • Project Scope
          • HueHarmony2.ino
          • Sampler_12bit.ino
        • Future Development
        • User Feedback
        • Research
      • infinish.ed
        • Proposed Solution – Unfini-shed
        • Proposed Solution – infinish.ed
        • User Experience Mapping
        • Design Justification
        • Roadblocks/Challenges
        • User Feedback
        • Conclusion
      • Pop-Up Symphony
      • Saltwater Greenhouse
      • Smart Protection Brace
        • Background Research
        • Initial Prototype
        • Iterations and Second Prototype
        • Next Steps
        • Potential Methods
        • User Group
    • 2016
      • Creation Station: An Interactive Kiosk
        • User Group
        • Feedback #1: Oakwood Community Dinner-November 14th, 2016
        • Feedback #2: Uncle Sam’s Bus Stop-November 15th, 2016
        • Feedback #3: Farmer’s Market- November 19th, 2016
        • Prototype and Final Build of the Kiosk
        • Final Testing and Final Thoughts
      • ElektroTone
      • Furnäture
      • Media Sanctuary Mobile Experience
        • Prototype 1
        • Prototype 2
        • Prototype 3
        • Next Steps
        • Presentation Slides
      • ObservaStory
        • Background Research
        • First Iteration
        • Second Iteration
        • Evaluation & Dissemination
      • People Library
        • Target User Group
        • Primary Iteration: The Event
        • Secondary Iteration: The System
          • The Website
          • The App
        • User Feedback: The Process
        • The Final Product
      • Physics Plank
        • Physics Plank 1.0
          • Design
          • User Feedback
        • Physics Plank 2.0
          • Design
          • User Feedback
        • Next Steps
          • Ideal Code and Construction
      • Portable Foundation Finder (PFF)
        • Background Research
        • Customer Discovery
          • Personas
          • Survey Responses
        • Prototype
        • User Testing
        • Working Demo
    • 2015
      • Alien Adaptation
        • Target User Group
        • First School Visit (September 28, 2015) – Prototype #1
        • Second School Visit (October 15, 2015) – Prototype #2
        • Third School Visit (November 9, 2015) – Prototype #3
        • Fourth School Visit (December 10th, 2015) – Prototype #4
        • Background Research
        • Alien Cards
        • Methods of Organization
        • Other Resources
      • Zoe the Green Monkey
        • Background Research
        • Evaluation & Dissemination
        • Sources for Further Teaching
      • Recipe Ratios
        • School 2 Visits
        • Background Research and Information
        • Context
        • Evaluation & Assessment
      • Space Race
        • Background Research
        • Evaluation and Assessment
        • Field Work : 1st Visit to School 2
        • Field Work : 2nd Visit to School 2
        • Field Work : 3rd Visit to School 2
        • Field Work : Final Visit to School 2
      • Rhythmatic
        • Overview/Background Research
        • User Research & Design Specifications
        • Lesson Plan
        • User Testing
        • Ethnographic Observations
        • Final Interface Design
    • 2014
      • Ghanaian Solar Heat Collection
        • Solar Production of Adinkra Ink
          • Adinkra Ink Background Information
            • Interview with Mae-Ling Lokko
            • Production of Adinkra Ink
        • Solar Production of Biochar
          • Biochar Information
          • Heliostat Development
            • Codes and Hardware
            • Phase 1: Small setup
            • Phase 2: Medium Setup
            • Phase 3: Future Design Considerations
          • Interviews with Marianne Nyman and Alex Allen
          • Planning the process
          • Prototype Design Process Images
        • Prototype Iterations
        • Testing
        • Future Prospects
      • Cheap Sensors for Quality Education
        • Building the Sensor
        • CSnap Integration for Data Visualization
        • Future Work
        • Hardware
        • Previous Iterations
        • Professional Development Integration
          • Compost Computing PD Outline
        • Transferring Data from Arduino to CSnap
        • Code (Integration with SD card data collection)
          • SD Card Readout Example
        • Code (Temperature and Humidity sensors only)
      • Condom Vending Machine
        • Cultural Background
        • Why Open Source?
        • Screen Printing Vs. Stickers
          • Hints for stickers!
        • Intitial Design Ideas
          • Initial Designs
        • Prototypes and feedback
        • Final Design
        • Feedback
        • Future Plans
      • Music & Sound: Earthquake Simulator
        • Prototyping & Iterations
          • Rounds 1 & 2
          • Round 3: Final Prototype
        • Field-Testing: User Feedback
        • How-To/DIY Projects
        • Future Testing
        • Dissemination
    • 2013
      • Edu-Ponics
        • The Community Garden
        • The Tower
        • The Monitoring Unit
          • Code
          • Prototype
        • Dissemination
        • User Feedback
        • About
      • Fraction Bot
        • Future Iterations
        • Primary Market Research
        • Prototyping/Testing
        • Source Code–Please Use
      • Ghana Outreach Solar Reflector
        • Cultural Background
        • Partnership with KNUST
        • Prototyping
          • Initial Mock-up
          • Lamination
          • Plywood Model
          • Reaction Chamber
          • Stainless Steel Ribs
        • Testing
        • Future Iterations
      • iQube
      • Lean Green Clean Machine
        • Background
        • Redesign Proposal
      • Music Factory
        • Prototype
        • Field Testing
        • Dissemination
      • Nutrition Kitchen
        • The Game
        • Learning About Nutrition
        • Children’s Reactions and Results
      • Solar Tracker
    • 2012
      • 2 Fast, 2 Curious
        • Learning Objectives
        • Make It Yourself!
          • Hardware
          • The Code
        • Responses
        • The Game
        • Downloads
      • Apollo 2 1/4
        • Children’s Reactions
        • Final Trip Notes
        • Fraction Practice
        • Materials & Software Used
        • Source Code
      • Coordinate Kinection
        • The Game
          • How to Play
          • Screenshots
        • Student Reactions
        • Do It Yourself
          • main.cpp
          • Instructions
          • Download
      • Discover The Universe
      • Power Up!
        • Make Your Own
        • Platform Theory
          • Software Theory
        • Research and Development
        • Student Reaction
      • Squid Learn
        • Building the Lesson Plan
        • How It’s Made
        • Research and Iterations
          • 1st Visit
          • 2nd Visit
          • 3rd Visit
        • Student Reactions
    • 2011
      • Alien Frontier
        • Downloads
        • The Process
          • Ethnographic Description
          • Ethnographic Description 1
          • Ethnographic Description 2
      • Cookie Creations
        • Cookie Creation Game
        • Classroom Process
        • Assessments and Surveys Used
        • Research
      • Fast Track
        • DIY
        • Learning Objectives
        • Materials
        • Response
        • Components
      • Make ’em Fresh
        • Make ’em Fresh: How It’s Made
          • Team Contributions
        • Make ’em Fresh: Research and Iterations
          • Early Concepts
          • Images: First and Second Visits
          • Future Iterations
        • Make ’em Fresh: Student Response
          • Pre- and Post-Testing
      • Rap Star
        • The Game
          • What?
          • When & Where?
          • Who?
          • Why?
        • Field Testing and Iterations
          • First Visit
          • Second Visit
          • Final Visit
          • Ethnographic Descriptions
        • What Now?
          • Conclusion
          • Future Iterations
          • Additional Images
      • Rush More
      • School House of Pop
        • Educational Goals
        • Student Response
        • Design Evolution
        • Future Design Aspirations
        • Culture and Society
        • Pictures at School

Theme: MistyLook by Sadish. WPMU Theme pack by WPMU-DEV.