added multiple games [broken]
This commit is contained in:
5
.vscode/settings.json
vendored
Normal file
5
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"files.associations": {
|
||||
"vector": "cpp"
|
||||
}
|
||||
}
|
||||
BIN
img/bottom_board.png
Normal file
BIN
img/bottom_board.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 185 KiB |
BIN
img/impression.png
Normal file
BIN
img/impression.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 145 KiB |
BIN
img/top_board.png
Normal file
BIN
img/top_board.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 246 KiB |
36
manufacturing/BOM_led_truck_v1_2020-09-27.csv
Normal file
36
manufacturing/BOM_led_truck_v1_2020-09-27.csv
Normal file
@@ -0,0 +1,36 @@
|
||||
ID;Name;Designator;place;Footprint;Quantity;Manufacturer Part;Manufacturer;Supplier;Supplier Part;
|
||||
1;20k;R1,R2;y;R_0402;2;RC0402FR-0720KL;;;;
|
||||
2;1K;R4,R7,R19,R8;y;R_0402;3;RC0402FR-7W1KL;;;;
|
||||
3;1M;R6;n;R_0402;1;RC0402FR-7W1ML;;;;
|
||||
4;0E;R3,R11;y;R_0402;2;AC0402JR-7D0RL;;;;
|
||||
10;10K;R18,R17,R10,R5;y;R_0402;3;RC0402FR-7W10KL;yageo;mouser;603-RC0402FR-7W10KL;
|
||||
11;470E;R9;y;R_0402;1;RCC0402470RFKED;vishay;mouser;71-RCC0402470RFKED;
|
||||
14;4.3p;C1,C2;y;C_0402;2;CC402CRNPO9BN4R3;yageo;mouser;603-CC402CRNPO9BN4R3;
|
||||
15;0.1u;C4,C5;y;C_0402;2;CC402KRX7R6BB104;yageo;mouser;603-CC402KRX7R6BB104;
|
||||
16;1u/10v;C6;y;C_0402;1;C0402C105K9PAC;kemet;mouser;80-C0402C105K9PAC;
|
||||
26;2.2u/10v;C8,C7,C9,C10;y;C_0805;4;LMK105BJ225KV-F;taiyo yuden;;963-LMK105BJ225KV-F;
|
||||
27;4.7u;C3;y;C_0805;1;CL05A475KQ5NRNC;samsung;mouser;187-CL05A475KQ5NRNC;
|
||||
17;2.2uH;L1;y;C_0805;1;ELG-TEA2R2NA;panasonic;mouser;667-ELG-TEA2R2NA;
|
||||
18;Jack_3.5_mini_5_pol;J1,J2,J3;Y;JACK 3.5 SHOGYO CORP;3;PS000059;multicomp;farnell;2900726;
|
||||
20;ZX62D-B-5PA8;J4;y;HIROSE_ZX62D-B-5PA8;1;ZX62D-B-5PA8(30);hirose;mouser;798-ZX62D-B-5PA830;
|
||||
21;LM3671MFX-3.3/NOPB;U3;y;SOT-23-5;1;LM3671MFX-1.2/NOPB;TI;LCSC;C130903;
|
||||
22;LED-Red(0603);D1;y;LED0603-FD;1;KT-0603R;lite-on;mouser;LTST-C191KRKT;
|
||||
24;LED-Blue(0603);D2;y;LED0603-FD;1;19-217/BHC-ZL1M2RY/3T;EVERLIGHT;mouser;LTST-C194TBKT;
|
||||
28;LED-0603_G;D3;y;LED0603-FD;1;19-217/GHC-YR1S2/3T;lite-on;mouser;LTST-C190KGKT;
|
||||
25;32.768KHz;X1;y;OSC-SMD_L3.2-W1.5;1;NX3215SA 32.768KHZ 12.5PF 20PPM;NDK;mouser;344-NX3215SA32768K8;
|
||||
29;MCP73832T-3ACI/OT;U2;y;SOT-23-5;1;MCP73832T-3ACI/OT;MICROCHIP;mouser;579-MCP73832T-3ACIOT;
|
||||
30;KSS241GLFS;SW1;y;KEY-SMD_KSS-2G;1;KSS241GLFS;C&K;mouser;611-KSS241GLFS;
|
||||
31;STM32L011F4P6;U4;y;TSSOP-20_L6.5-W4.4-P0.65-LS6.4-BL;1;STM32L011F4P6;STMicroelectronics;mouser;511-STM32L011F4P6;
|
||||
6;BSS84-7-F;Q2;y;SOT-23(SOT-23-3);1;BSS84-7-F;DIODES;LCSC;C85202;
|
||||
7;2n3904;Q3;y;SOT-23_1;1;MMBT3904,215;nexpoeria;;;
|
||||
33;HDR-F-2.54_1x4;H2;n;;;;;;;
|
||||
5;HDR-F-2.54_1x2;H1;n;;;;;;;
|
||||
23;HDR-F-2.54_1x3;H3;n;;;;;;;
|
||||
32;SOLDERJUMPER_2WAYPASTE23;BOOT0;n;;;;;;;
|
||||
;;;;;;;;;;
|
||||
;;;;;;;;;;
|
||||
;;;;;;;;;;comp
|
||||
;;;;;1;;;;;PCB
|
||||
;;;;;;;;;;montage
|
||||
;;;;;;;;;;total
|
||||
;;;;;;;;;;prijs/st
|
||||
|
BIN
manufacturing/BOM_led_truck_v1_2020-09-27.xlsx
Normal file
BIN
manufacturing/BOM_led_truck_v1_2020-09-27.xlsx
Normal file
Binary file not shown.
3402
manufacturing/Schematic_leo_led_truck_PROTO_2020-11-05_22-35-16.pdf
Normal file
3402
manufacturing/Schematic_leo_led_truck_PROTO_2020-11-05_22-35-16.pdf
Normal file
File diff suppressed because it is too large
Load Diff
BIN
manufacturing/mouser_BOM_led_truck_v1_2020-09-27.xlsx
Normal file
BIN
manufacturing/mouser_BOM_led_truck_v1_2020-09-27.xlsx
Normal file
Binary file not shown.
@@ -8,8 +8,9 @@
|
||||
; Please visit documentation for the other options and examples
|
||||
; https://docs.platformio.org/page/projectconf.html
|
||||
|
||||
[env:blackpill_f103c8]
|
||||
[env:nucleo_l031K6]
|
||||
platform = ststm32
|
||||
board = blackpill_f103c8
|
||||
board = nucleo_l031K6
|
||||
framework = arduino
|
||||
upload_port = stlink
|
||||
debug_tool = stlink
|
||||
|
||||
26
src/board.h
Normal file
26
src/board.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef BOARDH
|
||||
#define BOARDH
|
||||
|
||||
#define LED1 PB0 //D3
|
||||
#define LED2 PB7 //D4
|
||||
#define LED3 PB6 //D5
|
||||
|
||||
#define DETECT1 PA6 //A5
|
||||
#define DETECT2 PA5 //A4
|
||||
#define DETECT3 PA4 //A3
|
||||
|
||||
#define SWITCH1 PA7 //A6
|
||||
#define SWITCH12 PA2 //A7
|
||||
#define SWITCH2 PA1 //A1
|
||||
#define SWITCH22 PA3 //A2
|
||||
#define SWITCH3 PB3 //D13
|
||||
#define SWITCH32 PB4 //D12
|
||||
|
||||
#define LD3LED PB3
|
||||
|
||||
#define REDLEDRES
|
||||
#define YELLOWLEDRES
|
||||
#define GREENLEDRES
|
||||
|
||||
|
||||
#endif //BOARDH
|
||||
112
src/buttons.cpp
Normal file
112
src/buttons.cpp
Normal file
@@ -0,0 +1,112 @@
|
||||
#include "buttons.h"
|
||||
#include <vector>
|
||||
#include "Arduino.h"
|
||||
|
||||
std::vector<buttons *> buttonlist;
|
||||
|
||||
buttons::buttons(uint32_t pin, unsigned long shortpress, unsigned long longpress, unsigned int index):
|
||||
_buttonIndex(index), _buttonPin(pin)
|
||||
{
|
||||
_buttonDelayShort = shortpress;
|
||||
_buttonDelayLong = longpress;
|
||||
_buttonState = INVALID;
|
||||
_lastState = INVALID;
|
||||
buttonlist.push_back(this);
|
||||
}
|
||||
|
||||
void buttons::begin()
|
||||
{
|
||||
pinMode(_buttonPin, INPUT_PULLUP);
|
||||
}
|
||||
|
||||
buttonState_t buttons::state()
|
||||
{
|
||||
return _buttonState;
|
||||
}
|
||||
|
||||
buttonState_t buttons::lastState(void)
|
||||
{
|
||||
return _lastState;
|
||||
}
|
||||
|
||||
bool buttons::raw(void)
|
||||
{
|
||||
return _buttonFlag;
|
||||
}
|
||||
|
||||
void buttons::update(void)
|
||||
{
|
||||
unsigned long currentMillis = millis();
|
||||
_buttonFlag = !digitalRead(_buttonPin);
|
||||
if (_buttonFlag)
|
||||
{
|
||||
if (_buttonState == RELEASED)
|
||||
{
|
||||
//button not detected yet, check timer
|
||||
if ((currentMillis - _buttonTimer) >= _buttonDelayShort)
|
||||
{
|
||||
_buttonState = SHORT;
|
||||
_lastState = SHORT;
|
||||
}
|
||||
}
|
||||
else if (_buttonState == SHORT)
|
||||
{
|
||||
if ((currentMillis - _buttonTimer) >= _buttonDelayLong)
|
||||
{
|
||||
_buttonState = LONG;
|
||||
_lastState = LONG;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//button is not pressed, keep updating the timer
|
||||
_buttonState = RELEASED;
|
||||
_buttonTimer = millis();
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int buttons::index( void )
|
||||
{
|
||||
return _buttonIndex;
|
||||
}
|
||||
|
||||
|
||||
void initbuttons(void)
|
||||
{
|
||||
for (auto &&i : buttonlist)
|
||||
{
|
||||
i->begin();
|
||||
}
|
||||
}
|
||||
|
||||
void handleButtons(void)
|
||||
{
|
||||
for (auto &&i : buttonlist)
|
||||
{
|
||||
i->update();
|
||||
}
|
||||
}
|
||||
|
||||
bool anybutton(void)
|
||||
{
|
||||
handleButtons();
|
||||
for (auto &&i : buttonlist)
|
||||
{
|
||||
if (i->raw())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
buttons* getButton(unsigned int index)
|
||||
{
|
||||
for (auto &&i : buttonlist)
|
||||
{
|
||||
if( i->index() == index)
|
||||
return i;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
47
src/buttons.h
Normal file
47
src/buttons.h
Normal file
@@ -0,0 +1,47 @@
|
||||
#ifndef BUTTONSH
|
||||
#define BUTTONSH
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <vector>
|
||||
|
||||
|
||||
typedef enum buttonState_e
|
||||
{
|
||||
RELEASED,
|
||||
SHORT,
|
||||
LONG,
|
||||
INVALID
|
||||
}buttonState_t;
|
||||
|
||||
class buttons
|
||||
{
|
||||
const unsigned int _buttonIndex;
|
||||
const uint32_t _buttonPin;
|
||||
|
||||
unsigned long _buttonTimer;
|
||||
buttonState_t _buttonState;
|
||||
buttonState_t _lastState;
|
||||
bool _buttonFlag;
|
||||
unsigned long _buttonDelayShort;
|
||||
unsigned long _buttonDelayLong;
|
||||
|
||||
public:
|
||||
buttons(uint32_t pin, unsigned long shortpress, unsigned long longpress, unsigned int index);
|
||||
|
||||
void begin();
|
||||
|
||||
void update( void );
|
||||
|
||||
bool raw( void );
|
||||
|
||||
buttonState_t state();
|
||||
buttonState_t lastState();
|
||||
unsigned int index( void );
|
||||
};
|
||||
|
||||
bool anybutton( void );
|
||||
void initbuttons( void );
|
||||
void handleButtons( void );
|
||||
buttons* getButton(unsigned int index);
|
||||
|
||||
#endif //BUTTONSH
|
||||
87
src/chainGame.cpp
Normal file
87
src/chainGame.cpp
Normal file
@@ -0,0 +1,87 @@
|
||||
#include "chainGame.h"
|
||||
#include "Arduino.h"
|
||||
#include "buttons.h"
|
||||
|
||||
extern buttons button1;
|
||||
extern buttons button2;
|
||||
extern buttons button3;
|
||||
|
||||
|
||||
uint8_t patternIndex = 0;
|
||||
bool patternFlag = false;
|
||||
bool firstpattern = false;
|
||||
|
||||
uint8_t ledpattern[4][3] = {
|
||||
{1,0,0},
|
||||
{0,0,1},
|
||||
{1,0,0},
|
||||
{0,1,0},
|
||||
};
|
||||
int patternlength = sizeof(ledpattern)/sizeof(ledpattern[0]);
|
||||
|
||||
void nextPattern(void)
|
||||
{
|
||||
if (patternIndex < patternlength-1)
|
||||
{
|
||||
patternIndex++;
|
||||
}
|
||||
else
|
||||
{
|
||||
patternIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void HandleChainGame(void)
|
||||
{
|
||||
if (button1.state())
|
||||
{
|
||||
if (!patternFlag)
|
||||
{
|
||||
//button detected, increase pattern
|
||||
if(!firstpattern)
|
||||
{
|
||||
firstpattern = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
nextPattern();
|
||||
}
|
||||
|
||||
patternFlag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (button2.state())
|
||||
{
|
||||
if (!patternFlag)
|
||||
{
|
||||
if(!firstpattern)
|
||||
{
|
||||
firstpattern = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
//second input, skip a pattern
|
||||
nextPattern();
|
||||
nextPattern();
|
||||
}
|
||||
patternFlag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (button1.state() | button2.state())
|
||||
{
|
||||
//write pattern to the LEDs
|
||||
digitalWrite(LED1, ledpattern[patternIndex][0]);
|
||||
digitalWrite(LED2, ledpattern[patternIndex][1]);
|
||||
digitalWrite(LED3, ledpattern[patternIndex][2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
//leds off
|
||||
digitalWrite(LED1, 0);
|
||||
digitalWrite(LED2, 0);
|
||||
digitalWrite(LED3, 0);
|
||||
patternFlag = false;
|
||||
}
|
||||
}
|
||||
8
src/chainGame.h
Normal file
8
src/chainGame.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef CHAINGAMEH
|
||||
#define CHAINGAMEH
|
||||
|
||||
|
||||
void HandleChainGame( void );
|
||||
|
||||
|
||||
#endif //CHAINGAMEH
|
||||
27
src/detectled.cpp
Normal file
27
src/detectled.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "Arduino.h"
|
||||
#include "detectled.h"
|
||||
#include "buttons.h"
|
||||
#include "board.h"
|
||||
|
||||
extern buttons button1;
|
||||
extern buttons button2;
|
||||
extern buttons button3;
|
||||
|
||||
uint32_t detectled[3] = {0,0,0};
|
||||
|
||||
void handleDetectLed( void )
|
||||
{
|
||||
detectled[0] = analogRead(DETECT1);
|
||||
detectled[1] = analogRead(DETECT2);
|
||||
detectled[2] = analogRead(DETECT3);
|
||||
}
|
||||
|
||||
|
||||
void initDetectLed( void )
|
||||
{
|
||||
pinMode(DETECT1, INPUT_ANALOG);
|
||||
pinMode(DETECT2, INPUT_ANALOG);
|
||||
pinMode(DETECT3, INPUT_ANALOG);
|
||||
analogReadResolution(10);
|
||||
|
||||
}
|
||||
8
src/detectled.h
Normal file
8
src/detectled.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef DETECTLEDH
|
||||
#define DETECTLEDH
|
||||
|
||||
void handleDetectLed( void );
|
||||
void initDetectLed( void );
|
||||
|
||||
|
||||
#endif //DETECTLED
|
||||
122
src/magicSwitchBoard.cpp
Normal file
122
src/magicSwitchBoard.cpp
Normal file
@@ -0,0 +1,122 @@
|
||||
#include "magicSwitchBoard.h"
|
||||
#include "Arduino.h"
|
||||
#include "buttons.h"
|
||||
|
||||
#define CHANNELS 3
|
||||
|
||||
typedef enum
|
||||
{
|
||||
idle,
|
||||
learn,
|
||||
active,
|
||||
last
|
||||
} states;
|
||||
|
||||
states state = last;
|
||||
uint8_t sequence[CHANNELS] = {0, 0, 0};
|
||||
const uint8_t buttonIndex[CHANNELS] = {4, 5, 3};
|
||||
const uint32_t leds[CHANNELS] = {LED1, LED2, LED3};
|
||||
|
||||
uint8_t learnIndex = 0;
|
||||
|
||||
void showLeds(void)
|
||||
{
|
||||
//loop through the button list
|
||||
for (int i = 0; i < CHANNELS; i++)
|
||||
{
|
||||
//check if the position is already programmed
|
||||
if (sequence[i])
|
||||
{
|
||||
//get the button pointer
|
||||
buttons *currentbutton = getButton(buttonIndex[i]);
|
||||
|
||||
//verify that the button pointer is not NULL
|
||||
if (currentbutton == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//if the button is pressed, show LED or not
|
||||
if (currentbutton->state() == !RELEASED)
|
||||
{
|
||||
//write sequence led on
|
||||
digitalWrite(leds[sequence[i] + 1], 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
//write sequence led off
|
||||
digitalWrite(leds[sequence[i] + 1], 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void handleMagicSwitchBoard(void)
|
||||
{
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case idle:
|
||||
{
|
||||
if (anybutton())
|
||||
{
|
||||
state = learn;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (auto &&i : leds)
|
||||
{
|
||||
digitalWrite(i, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case learn:
|
||||
{
|
||||
for (int i = 0; i < CHANNELS; i++)
|
||||
{
|
||||
buttons *currentbutton = getButton(buttonIndex[i]);
|
||||
if (currentbutton == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentbutton->state() == !RELEASED)
|
||||
{
|
||||
bool duplicate = false;
|
||||
for (auto &&n : sequence)
|
||||
{
|
||||
if (currentbutton->index() == n)
|
||||
{
|
||||
duplicate = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!duplicate)
|
||||
{
|
||||
sequence[learnIndex] = currentbutton->index();
|
||||
learnIndex++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (learnIndex == CHANNELS)
|
||||
{
|
||||
state = active;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case active:
|
||||
{
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
state = idle;
|
||||
}
|
||||
break;
|
||||
}
|
||||
showLeds();
|
||||
}
|
||||
6
src/magicSwitchBoard.h
Normal file
6
src/magicSwitchBoard.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef MAGICSWITCHBOARDH
|
||||
#define MAGICSWITCHBOARDH
|
||||
|
||||
void handleMagicSwitchBoard( void );
|
||||
|
||||
#endif //MAGICSWITCHBOARDH
|
||||
133
src/main.cpp
133
src/main.cpp
@@ -1,91 +1,82 @@
|
||||
#include <Arduino.h>
|
||||
#include "buttons.h"
|
||||
#include "board.h"
|
||||
#include "chainGame.h"
|
||||
#include "detectled.h"
|
||||
#include "magicSwitchBoard.h"
|
||||
|
||||
#define LED1 PB14
|
||||
#define LED2 PB15
|
||||
#define LED3 PA8
|
||||
#define BUTTON1 PA0
|
||||
#define BUTTON2 PA1
|
||||
buttons button1(SWITCH12, 100, 1000, 1);
|
||||
buttons button2(SWITCH22, 100, 1000, 2);
|
||||
buttons button3(SWITCH32, 100, 1000, 3);
|
||||
buttons button4(SWITCH1, 100, 1000, 4);
|
||||
buttons button5(SWITCH2, 100, 1000, 5);
|
||||
buttons button6(SWITCH3, 100, 1000, 6);
|
||||
|
||||
|
||||
|
||||
|
||||
uint8_t patternIndex = 0;
|
||||
bool patternFlag = false;
|
||||
|
||||
|
||||
uint8_t ledpattern[5][3] = {
|
||||
{1,0,0},
|
||||
{0,0,1},
|
||||
{0,1,0},
|
||||
{0,1,0},
|
||||
{0,0,1}
|
||||
};
|
||||
|
||||
int patternlength = sizeof(ledpattern)/sizeof(ledpattern[0]);
|
||||
|
||||
void nextPattern( void )
|
||||
typedef enum
|
||||
{
|
||||
patternIndex++;
|
||||
if(patternIndex > patternlength)
|
||||
{
|
||||
patternIndex = 0;
|
||||
}
|
||||
}
|
||||
none,
|
||||
ChainGame,
|
||||
magicSwitchBoard,
|
||||
detectLED,
|
||||
last
|
||||
} game;
|
||||
|
||||
buttons button1(BUTTON1, 100,1000);
|
||||
buttons button2(BUTTON2, 100,1000);
|
||||
game currentGame = none;
|
||||
uint8_t gameState = 0;
|
||||
unsigned long gameTimeout = 0;
|
||||
|
||||
|
||||
void setup()
|
||||
void setup()
|
||||
{
|
||||
pinMode(LED1, OUTPUT);
|
||||
pinMode(LED2, OUTPUT);
|
||||
pinMode(LED3, OUTPUT);
|
||||
|
||||
button1.begin();
|
||||
button2.begin();
|
||||
|
||||
initbuttons();
|
||||
|
||||
initDetectLed();
|
||||
|
||||
while (anybutton())
|
||||
{
|
||||
digitalWrite(LED1, 1);
|
||||
digitalWrite(LED2, 1);
|
||||
digitalWrite(LED3, 1);
|
||||
if (button4.raw())
|
||||
{
|
||||
currentGame = ChainGame;
|
||||
}
|
||||
if (button5.raw())
|
||||
{
|
||||
currentGame = magicSwitchBoard;
|
||||
}
|
||||
if (button6.raw())
|
||||
{
|
||||
currentGame = detectLED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void loop()
|
||||
void loop()
|
||||
{
|
||||
button1.update();
|
||||
button2.update();
|
||||
|
||||
if(button1.state())
|
||||
{
|
||||
if(!patternFlag)
|
||||
{
|
||||
//button detected, increase pattern
|
||||
nextPattern();
|
||||
patternFlag = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(button2.state())
|
||||
{
|
||||
if(!patternFlag)
|
||||
{
|
||||
//second input, skip a pattern
|
||||
nextPattern();
|
||||
nextPattern();
|
||||
patternFlag = true;
|
||||
}
|
||||
}
|
||||
handleButtons();
|
||||
|
||||
if(button1.state() | button2.state() )
|
||||
switch (currentGame)
|
||||
{
|
||||
//write pattern to the LEDs
|
||||
digitalWrite(LED1,!ledpattern[patternIndex][0]);
|
||||
digitalWrite(LED2,!ledpattern[patternIndex][1]);
|
||||
digitalWrite(LED3,!ledpattern[patternIndex][2]);
|
||||
case magicSwitchBoard:
|
||||
{
|
||||
handleMagicSwitchBoard();
|
||||
}
|
||||
else
|
||||
break;
|
||||
|
||||
case detectLED:
|
||||
{
|
||||
//leds off
|
||||
digitalWrite(LED1,1);
|
||||
digitalWrite(LED2,1);
|
||||
digitalWrite(LED3,1);
|
||||
patternFlag = false;
|
||||
handleDetectLed();
|
||||
}
|
||||
break;
|
||||
|
||||
case ChainGame:
|
||||
default:
|
||||
{
|
||||
HandleChainGame();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user