Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void loop() {
- // put your main code here, to run repeatedly:
- }
- //Psuedocode attempt to make an LED thingy
- // Importing needed libraries
- #include <FastLED.h>
- #include <IRremote.h>
- #define NUM_LEDS 300
- CRGB leds[NUM_LEDS];
- #define data_pin 5
- // defining various zones. Zone 1 = Under cabinet, Zone 2 = Around window etc.
- zone1 = leds [0:24]
- zone2 = leds [24:172]
- zone3 = leds [173:277]
- zone4 = leds [278:299]
- void setup() {
- // put your setup code here, to run once:
- FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS);
- }
- void preset1(){
- for led in zone1:
- ledRGB = (160, 0, 210)
- for led in zone2:
- ledRGB = (120, 0, 24)
- for led in zone3:
- ledRGB = (0, 0, 0)
- for led in zone4:
- ledRGB = (100,100,100)
- // Make a whole bunch more of these normal presets
- Def preset6()
- for led in zone1:
- do cool fastled effect thing
- for led in zone2:
- do different fastled effect thing
- for led in zone3:
- ledRGB = (0, 0, 0)
- for led in zone4:
- ledRGB = (0, 0, 0)
- // Make a whole bunch more of these fancy presets
- Def BrightnessUp()
- i = 0
- for num_led in zone1 and zone2 and zone3 and zone4:
- if i in ledRGB > 0: //This is to minimise colour shift. Any RGB channel set at 0 won’t increase.
- i = i+10
- else:
- return
- // Similar for brightness down
- void setup() {
- FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS);
- {
- //The following is mostly copy pasted C++ code with modifications
- //It works to understand the IR remote inputs and call functions based on input
- const int RECV_PIN = 7;
- IRrecv irrecv(RECV_PIN);
- decode_results results;
- unsigned long key_value = 0;
- void setup(){
- irrecv.enableIRIn();
- irrecv.blink13(true);
- }
- void loop(){
- if (irrecv.decode(&results)){
- if (results.value == 0XFFFFFFFF)
- results.value = key_value;
- switch(results.value)
- case 0xFF30CF:
- Serial.println("1");
- Call preset1()
- break ;
- case 0xFF18E7:
- Serial.println("2");
- Call preset2()
- break ;
- case 0xFF7A85:
- Serial.println("3");
- Call preset3()
- break ;
- //ETC for every number on remote
- case 0xFFE01F:
- Serial.println("-");
- Call BrigtnessDown()
- break ;
- case 0xFFA857:
- Serial.println("+");
- Call BrightnessUp()
- break ;
- }
- key_value = results.value;
- irrecv.resume();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement