|
|
@ -4,6 +4,9 @@ |
|
|
|
|
|
|
|
#include "led.h" |
|
|
|
#include "hardware.h" |
|
|
|
#include "coin.h" |
|
|
|
|
|
|
|
extern Coin coin; |
|
|
|
|
|
|
|
using namespace std; |
|
|
|
|
|
|
@ -49,6 +52,26 @@ void Led::loop_denied(void) { |
|
|
|
|
|
|
|
void Led::loop_steady(void) { |
|
|
|
fill_solid(leds, NUM_LEDS, color); |
|
|
|
if (int moneyinserted = coin.isMoneyInserted()) { |
|
|
|
fill_solid(leds, 8, CRGB::Black); |
|
|
|
if (moneyinserted >= 5) { |
|
|
|
leds[0] = CRGB::Yellow; |
|
|
|
} if (moneyinserted >= 10) { |
|
|
|
leds[1] = CRGB::Yellow; |
|
|
|
} if (moneyinserted >= 20) { |
|
|
|
leds[2] = CRGB::Yellow; |
|
|
|
} if (moneyinserted >= 50) { |
|
|
|
leds[3] = CRGB::Yellow; |
|
|
|
} if (moneyinserted >= 75) { |
|
|
|
leds[4] = CRGB::Yellow; |
|
|
|
} if (moneyinserted >= 100) { |
|
|
|
leds[5] = CRGB::Yellow; |
|
|
|
} if (moneyinserted >= 150) { |
|
|
|
leds[6] = CRGB::Yellow; |
|
|
|
} if (moneyinserted >= 200) { |
|
|
|
leds[7] = CRGB::Yellow; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void Led::changeAnimation(uint8_t num, uint16_t duration) { |
|
|
@ -67,7 +90,11 @@ void Led::changeColor(uint8_t r, uint8_t g, uint8_t b) { |
|
|
|
change = true; |
|
|
|
} |
|
|
|
void Led::changeBrightness(uint8_t brightness) { |
|
|
|
FastLED.setBrightness(brightness); |
|
|
|
if (brightness > 254) { // don't set first byte to 255 on tm1829
|
|
|
|
FastLED.setBrightness(254); |
|
|
|
} else { |
|
|
|
FastLED.setBrightness(brightness); |
|
|
|
} |
|
|
|
change = true; |
|
|
|
} |
|
|
|
|
|
|
|