release 0.1
This commit is contained in:
26
src/main.cpp
26
src/main.cpp
@@ -5,21 +5,18 @@
|
||||
#include "detectled.h"
|
||||
#include "magicSwitchBoard.h"
|
||||
#include "buttons.h"
|
||||
#include "JC_Button.h"
|
||||
#include "vector"
|
||||
//#include "JC_Button.h"
|
||||
#include "led.h"
|
||||
|
||||
// extern ToggleButton button1;
|
||||
// extern ToggleButton button2;
|
||||
// extern ToggleButton button3;
|
||||
extern ToggleButton button4;
|
||||
extern ToggleButton button5;
|
||||
extern ToggleButton button6;
|
||||
|
||||
extern c_button button1;
|
||||
extern c_button button2;
|
||||
extern c_button button3;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
none,
|
||||
powerOff,
|
||||
sleep,
|
||||
ChainGame,
|
||||
magicSwitchBoard,
|
||||
detectLED,
|
||||
@@ -28,13 +25,13 @@ typedef enum
|
||||
|
||||
game currentGame = none;
|
||||
uint8_t gameState = 0;
|
||||
unsigned long gameTimeout = 0;
|
||||
|
||||
void setup()
|
||||
{
|
||||
pinMode(LED1, OUTPUT);
|
||||
pinMode(LED2, OUTPUT);
|
||||
pinMode(LED3, OUTPUT);
|
||||
pinMode(SYS_WKUP3, INPUT);
|
||||
|
||||
c_leds *ledlist = getledlist();
|
||||
|
||||
@@ -51,6 +48,7 @@ void setup()
|
||||
void loop()
|
||||
{
|
||||
handleButtons();
|
||||
//handleSystemTimeout();
|
||||
|
||||
switch (currentGame)
|
||||
{
|
||||
@@ -79,17 +77,17 @@ void loop()
|
||||
digitalWrite(LED1, 0);
|
||||
digitalWrite(LED2, 0);
|
||||
digitalWrite(LED3, 0);
|
||||
if (button4.isPressed())
|
||||
if (button1.isPressed())
|
||||
{
|
||||
digitalWrite(LED1, 1);
|
||||
}
|
||||
if (button5.isPressed())
|
||||
if (button2.isPressed())
|
||||
{
|
||||
currentGame = magicSwitchBoard;
|
||||
digitalWrite(LED2, 1);
|
||||
}
|
||||
|
||||
if (button6.isPressed())
|
||||
if (button3.isPressed())
|
||||
{
|
||||
digitalWrite(LED3, 1);
|
||||
currentGame = detectLED;
|
||||
@@ -98,5 +96,7 @@ void loop()
|
||||
while (anybutton());
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user