iRockPaperScissors
Published © GPL3+

iRockPaperScissors - The Particle Argon Game

A new version of the game “Rock, Paper, Scissors” that integrates modern technologies like the Particle Argon, IFTTT app, and Google Sheets

IntermediateFull instructions provided3.5 hours351
iRockPaperScissors - The Particle Argon Game

Things used in this project

Hardware components

Argon
Particle Argon
×3
LED (generic)
LED (generic)
The particle argon kit comes with it's own red LED. Purchasing another red LED is not required.
×3
Elegoo Sensor Modules Kit (Membrane Switch)
Only the Membrane Switch (Keypad) will be used for this project.
×3
Breadboard Wire Kit
Digilent Breadboard Wire Kit
Any Breadboard and wire kit will be compatible with the particle argon for this project.
×1

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE
Maker service
IFTTT Maker service
Google Sheets
Google Sheets

Story

Read more

Schematics

Circuit Schematic

The 4x4 Membrane Switch (Keypad) utilizes eight wires for eight different connections to the particle argon (4 rows, 4 columns). These wires should be connected from the keypad to the argon's data pins from D1 to D8. The shorter leg of the red LED should be wired to ground. The longer leg of the red LED should be connected to 3.3V positive and in series with the 220 ohm resistor and the D9 argon data pin. The other end of the 220 ohm resistor should be wired to ground.

Code

Code for iRockPaperScissors Game

Arduino
The software used to create the code was the build.particle.io website. The website should also be connected to the particle argon via wifi to be able to flash the code created to the parrticle argon.
#include <Keypad_Particle.h>

const int ROW_NUM = 4; //four rows
const int COLUMN_NUM = 4; //4 columns

int led1 = D9; // Instead of writing D9 over and over again, we'll write led1
// You'll need to wire an LED to this one to see it blink.



char keys[ROW_NUM][COLUMN_NUM] = {
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'}
};

byte pin_rows[ROW_NUM] = {8, 7, 6, 5}; //connect to the row pinouts of the keypad
byte pin_column[COLUMN_NUM] = {4, 3, 2,1}; //connect to the column pinouts of the keypad

Keypad keypad = Keypad( makeKeymap(keys), pin_rows, pin_column, ROW_NUM, COLUMN_NUM );


void setup() { 

  Serial.begin(9600);
  //For your project you can change "keypressedharrison" to "keypressed____" and insert your name or any other word.
  Particle.variable("keypressedharrison",keys[ROW_NUM][COLUMN_NUM]);
  
   // Configure the pins to be outputs
   pinMode(led1, OUTPUT);

 
   
      //Register our Particle function here
   Particle.function("led", ledControl);
}

void loop(){
 
  char key = keypad.getKey();
if (key){
    Serial.println(key);
     //For your project you can change "keypressedharrison" to "keypressed____" and insert your name or any other word.
    Particle.publish("keypressedharrison", String(key), PUBLIC);

  }
}


int ledControl(String command)
{

   // find out the state of the led
   // you can write any word instead of "LOW". This is simply the command used to trigger your function. 
   if(command == "LOW"){
	   digitalWrite(led1, LOW);
	   delay (1000);
	   digitalWrite(led1,HIGH);
   }

}

//References
// Particle Library: <Keypad_Particle.h>
// Code for Keypad: https://arduinogetstarted.com/tutorials/arduino-keypad
// Reference code for LED: https://arduinogetstarted.com/tutorials/arduino-keypad

Credits

iRockPaperScissors
1 project • 0 followers
Contact
Thanks to Jameson Cunningham, Kenneth Elrod, and Harrison Peddle .

Comments

Please log in or sign up to comment.