Skip to content

Commit

Permalink
added crossfade funtion and examples
Browse files Browse the repository at this point in the history
  • Loading branch information
dekuNukem committed Mar 5, 2018
1 parent b6bdc03 commit c32e6cc
Show file tree
Hide file tree
Showing 23 changed files with 457 additions and 115 deletions.
1 change: 1 addition & 0 deletions arduino_examples/0_LED_test/0_LED_test.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#define SPI_BUF_SIZE 16

uint8_t spi_buf[SPI_BUF_SIZE];
// change this to the cs pin you're using
const int slaveSelectPin = 10;

void setup()
Expand Down
3 changes: 2 additions & 1 deletion arduino_examples/1_show4/1_show4.ino
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
exixe "Getting Started" guide
https://github.com/dekuNukem/exixe/blob/master/getting_started.md
Demo 1: Show digit 4 on Nixie tube with orange backligt
Demo 1: Show digit 4 with orange backlight
*/

#include <SPI.h>
#define SPI_BUF_SIZE 16

uint8_t spi_buf[SPI_BUF_SIZE];
// change this to the cs pin you're using
const int slaveSelectPin = 10;

void setup()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
exixe "Getting Started" guide
https://github.com/dekuNukem/exixe/blob/master/getting_started.md
Demo 2: Show every digit in a loop, using the exixe library
Demo 2: loop digits
*/

#include "exixe.h"
Expand All @@ -18,7 +18,8 @@ exixe my_tube = exixe(cs_pin);

void setup()
{
;
my_tube.clear();
my_tube.set_led(127, 0, 127); // purple
}

void loop()
Expand All @@ -27,11 +28,8 @@ void loop()
/*
1st arg: Digit to show, 0 to 9
2nd arg: Digit brightness, 0 to 127
3rd arg: Backlight red, 0 to 127
4th arg: Backlight green, 0 to 127
5th arg: Backlight blue, 0 to 127
6th arg: Overdrive, 0 disable 1 enable
3rd arg: Overdrive, 0 disable 1 enable
*/
my_tube.show(count, 127, 127, 0, 127, 0);
my_tube.show_digit(count, 127, 0);
delay(500);
}
44 changes: 44 additions & 0 deletions arduino_examples/3_loop_digit_crossfade/3_loop_digit_crossfade.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
Demo for exixe modules
https://github.com/dekuNukem/exixe
exixe "Getting Started" guide
https://github.com/dekuNukem/exixe/blob/master/getting_started.md
Demo 3: Loop digits with crossfade animation
*/

#include "exixe.h"

// change this to the cs pin you're using
int cs_pin = 10;
unsigned char count;
exixe my_tube = exixe(cs_pin);

void setup()
{
my_tube.clear();
my_tube.set_led(127, 0, 127); // purple
}

void loop()
{
count++;
/*
1st arg: Digit to show, 0 to 9
2nd arg: how many frames does crossfade last, 30 frames = 1 second
3rd arg: digit brightness, 0 to 127
4th arg: overdrive, 0 disable 1 enable
This function sets up the crossfade animation
call crossfade_run() to actually start it
*/
my_tube.crossfade_init(count, 15, 127, 0);

// crossfade_run() is non-blocking and returns right away
// call it regularly(at least every 33ms) for a smooth animation
// check its return value to see if the animation is finished
while(my_tube.crossfade_run() == EXIXE_ANIMATION_IN_PROGRESS)
;
delay(250);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
exixe "Getting Started" guide
https://github.com/dekuNukem/exixe/blob/master/getting_started.md
Demo 2: Loop digits on two tubes, using the exixe library
Demo 4: Loop digits on two tubes
*/


#include "exixe.h"

// change those to the cs pins you're using
int cs1 = 10;
int cs2 = 9;
unsigned char count;
Expand All @@ -20,13 +21,16 @@ exixe my_tube2 = exixe(cs2);

void setup()
{
;
my_tube1.clear();
my_tube2.clear();
my_tube1.set_led(127, 0, 127); // purple;
my_tube2.set_led(127, 127, 0); // yellow;
}

void loop()
{
count = (count + 1) % 10; // keep count between 0 to 9
my_tube1.show(count, 127, 127, 0, 127, 0);
my_tube2.show(10 - count, 127, 0, 127, 0, 0);
my_tube1.show_digit(count, 127, 0);
my_tube2.show_digit(10 - count, 127, 0);
delay(500);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
Demo for exixe modules
https://github.com/dekuNukem/exixe
exixe "Getting Started" guide
https://github.com/dekuNukem/exixe/blob/master/getting_started.md
Demo 5: Loop digits on two tubes with crossfade animation
*/


#include "exixe.h"

// change those to the cs pins you're using
int cs1 = 10;
int cs2 = 9;
unsigned char count;

exixe my_tube1 = exixe(cs1);
exixe my_tube2 = exixe(cs2);

void setup()
{
my_tube1.clear();
my_tube2.clear();
my_tube1.set_led(127, 0, 127); // purple;
my_tube2.set_led(127, 127, 0); // yellow;
}

void loop()
{
count = (count + 1) % 10; // keep count between 0 to 9

my_tube1.crossfade_init(count, 15, 127, 0);
my_tube2.crossfade_init(10-count, 15, 127, 0);

while(1)
{
unsigned char result1 = my_tube1.crossfade_run();
unsigned char result2 = my_tube2.crossfade_run();
if(result1 == EXIXE_ANIMATION_FINISHED && result2 == EXIXE_ANIMATION_FINISHED)
break;
}

delay(250);
}
27 changes: 0 additions & 27 deletions arduino_examples/exixe/examples/digit_loop/digit_loop.ino

This file was deleted.

51 changes: 0 additions & 51 deletions arduino_examples/exixe/exixe.cpp

This file was deleted.

18 changes: 0 additions & 18 deletions arduino_examples/exixe/exixe.h

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
Demo for exixe modules
https://github.com/dekuNukem/exixe
exixe "Getting Started" guide
https://github.com/dekuNukem/exixe/blob/master/getting_started.md
Demo 2: loop digits
*/

#include "exixe.h"

// change this to the cs pin you're using
int cs_pin = 10;
unsigned char count;

exixe my_tube = exixe(cs_pin);

void setup()
{
my_tube.clear();
my_tube.set_led(127, 0, 127); // purple
}

void loop()
{
count++;
/*
1st arg: Digit to show, 0 to 9
2nd arg: Digit brightness, 0 to 127
3rd arg: Overdrive, 0 disable 1 enable
*/
my_tube.show_digit(count, 127, 0);
delay(500);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
Demo for exixe modules
https://github.com/dekuNukem/exixe
exixe "Getting Started" guide
https://github.com/dekuNukem/exixe/blob/master/getting_started.md
Demo 3: Loop digits with crossfade animation
*/

#include "exixe.h"

// change this to the cs pin you're using
int cs_pin = 10;
unsigned char count;
exixe my_tube = exixe(cs_pin);

void setup()
{
my_tube.clear();
my_tube.set_led(127, 0, 127); // purple
}

void loop()
{
count++;
/*
1st arg: Digit to show, 0 to 9
2nd arg: how many frames does crossfade last, 30 frames = 1 second
3rd arg: digit brightness, 0 to 127
4th arg: overdrive, 0 disable 1 enable
This function sets up the crossfade animation
call crossfade_run() to actually start it
*/
my_tube.crossfade_init(count, 15, 127, 0);

// crossfade_run() is non-blocking and returns right away
// call it regularly(at least every 33ms) for a smooth animation
// check its return value to see if the animation is finished
while(my_tube.crossfade_run() == EXIXE_ANIMATION_IN_PROGRESS)
;
delay(250);
}
Loading

0 comments on commit c32e6cc

Please sign in to comment.