Spelling Magic

We needed to find a problem in the world, and then fix it through the use of physical computing. Our problem is that we simply hate spelling mistakes. To make people spell correctly you need to get to them early. We made a simple game for kids to play with, that will give them immediate feedback on whether they are spelling right or wrong. In the short video below we are spelling the word ART. This is a prototype, which means some other 3 letter words can be spelled, but unfortunately not all words. The game is limited because we have not made enough contacts in each letter space for all letters of the alphabet to be used.

THIS IS HOW IT WORKS

THIS IS OUR LITTLE SECRET

AND THIS IS THE MIGHTY GAME BRAIN
…or the code behind it if you like. Except that in this code example, the user has to spell the word CAT instead. I guess CAT is a bit more kid-friendly than the word ART. Anyway. Game brain coming up:

//PIN FOR THE LED LIGHTS CONNECTED TO PLACES ON BLOCK TRAY

#define LED 10 // the pin for the LED for first letter block
#define LED2 11 // the pin for the LED for 2nd letter block
#define LED3 12 // the pin for the LED for 3rd letter block

//THE CONTACT SPOTS ON THE BLOCK TRAY

#define P1X 2 // the input pin where the contact for block 1 is connected
#define P1Y 3 // the input pin where the contact for block 1 is connected
#define P2X 4 // the input pin where the contact for block 2 is connected
#define P2Y 5 // the input pin where the contact for block 2 is connected
#define P3X 6 // the input pin where the contact for block 3 is connected
#define P3Y 7// the input pin where the contact for block 3 is connected

//STORING STATE OF THE INPUT PINS FROM LETTER BLOCKS

int placeX = 0; // val will be used to store the state of the input pin
int placeY = 0; // val will be used to store the state of the input pin
int place2X = 0; // val will be used to store the state of the input pin
int place2Y = 0; // val will be used to store the state of the input pin
int place3X = 0; // val will be used to store the state of the input pin
int place3Y = 0; // val will be used to store the state of the input pin

//THE WORD THE USER MUST SPELL

String theword = «CAT»; // using a constant String

void setup() {
pinMode(LED, OUTPUT); // tell Arduino LED is an output
pinMode(LED2, OUTPUT); // tell Arduino LED is an output
pinMode(LED3, OUTPUT); // tell Arduino LED is an output
pinMode(P1X, INPUT); // and contact is an input
pinMode(P1Y, INPUT); // and contact is an input
pinMode(P2X, INPUT); // and contact is an input
pinMode(P2Y, INPUT); // and contact is an input
pinMode(P3X, INPUT); // and contact is an input
pinMode(P3Y, INPUT); // and contact is an input
}

void loop(){
//READING EACH OF THE LETTERS IN THE WORD
int letter1 = theword.charAt(0);
int letter2 = theword.charAt(1);
int letter3 = theword.charAt(2);

//READING EACH OF THE LETTER BLOCKS
placeX = digitalRead(P1X); // read input value and store it
placeY = digitalRead(P1Y); // read input value and store it
place2X = digitalRead(P2X); // read input value and store it
place2Y = digitalRead(P2Y); // read input value and store it
place3X = digitalRead(P3X); // read input value and store it
place3Y = digitalRead(P3Y); // read input value and store it

//CHECKING LETTERPLACE 1
// CHECK whether input from the block is HIGH-HIGH (A)
if (placeX == HIGH && placeY == HIGH) {
if(letter1 == ‘A’) {
digitalWrite(LED, HIGH); // turn LED ON
}
}

// CHECK whether input from the block is HIGH-LOW (T)
else if (placeX == HIGH && placeY == LOW) {
if(letter1 == ‘T’) {
digitalWrite(LED, HIGH); // turn LED ON
}
}

// CHECK whether input from the block is LOW-HIGH (C or R or F)
// Made the same pattern underneath the C, R and F letter blocks
// The child can then play with different words that can be spelled with _AT
else if (placeX == LOW && placeY == HIGH) {
if(letter1 == ‘C’) {
digitalWrite(LED, HIGH); // turn LED ON
}
}

//CHECKING LETTERPLACE 2
// CHECK whether input from the block is HIGH-HIGH (A)
if (place2X == HIGH && place2Y == HIGH) {
if(letter2 == ‘A’) {
digitalWrite(LED2, HIGH); // turn LED ON
}
}

// CHECK whether input from the block is HIGH-LOW (T)
else if (place2X == HIGH && place2Y == LOW) {
if(letter2 == ‘T’) {
digitalWrite(LED2, HIGH); // turn LED ON
}
}

// CHECK whether input from the block is LOW-HIGH (C or R or F)
else if (place2X == LOW && place2Y == HIGH) {
if(letter2 == ‘C’) {
digitalWrite(LED2, HIGH); // turn LED ON
}
}

//CHECKING LETTERPLACE 3
// CHECK whether input from the block is HIGH-HIGH (A)
if (place3X == HIGH && place3Y == HIGH) {
if(letter3 == ‘A’) {
digitalWrite(LED3, HIGH); // turn LED ON
}
}

// CHECK whether input from the block is HIGH-LOW (T)
else if (place3X == HIGH && place3Y == LOW) {
if(letter3 == ‘T’) {
digitalWrite(LED3, HIGH); // turn LED ON
}
}

// CHECK whether input from the block is LOW-HIGH (C or R or F)
else if (place3X == LOW && place3Y == HIGH) {
if(letter3 == ‘C’) {
digitalWrite(LED3, HIGH); // turn LED ON
}
}

//CHECKING IF BLOCK IS REMOVED

if (placeX == LOW && placeY == LOW) {
digitalWrite(LED, LOW); // turns the LED off*/
}
if (place2X == LOW && place2Y == LOW) {
digitalWrite(LED2, LOW); // turns the LED off*/
}
if (place3X == LOW && place3Y == LOW) {
digitalWrite(LED3, LOW); // turns the LED off*/
}
}

Leave a Reply