Windows GUI for Arduino light show (eg pattern generator) - Page 1
Forum section: electronics / projects

author: deejay2k1
author_rank: Newbie
timestamp: November 30, 2016, 10:32:26 am
content: Let me present to the community a small project of mine.The main purpose was to simplify the array generation needed for the Christmas light showBut it somewhat evolved. So please review it, post tips for new features, use it or discard itCompiled and tested on Windows 7, 32bitUser manual: + and - sequence buttons adds or removes a sequence (last one). sequence is 8 bit, LSB first, hex notation (eg 0x01)copy and paste buttons: copies into/from windows clipboard the array containing the patterns.ino button: (beginner friendly) copies into clipboard the entire Arduino sketch. Just paste it into Arduino IDE (please delete all from the sketch before paste). After that, you could paste only the array from the step above.Please see attached image for the Knight Rider exampleLink for the GUI:http://goo.gl/TA6MHCEnjoy!

author: AlessandroAU
author_rank: Regular Contributor
timestamp: December 01, 2016, 01:38:58 pm
content: This is really cool thanks.It will be very handy for creating custom fonts.

author: deejay2k1
author_rank: Newbie
timestamp: December 01, 2016, 02:11:37 pm
content: Good idea. Bear in mind that it has (for the moment) a limit of 99 patterns. Shall be corrected in the next version.I'm thinking to add Charlieplexing encoding also, if it gathers at least a couple votes.Also I want to add a second matrix for built-in effects. As in specify the first pattern as single lit LED and tell it to shift or rotate, blink or whatever. The .ino code will be more compact then.

author: deejay2k1
author_rank: Newbie
timestamp: December 03, 2016, 12:10:34 am
content: Update:GUI version 1.1 with 512 sequences now available.Finished working on Arduino side with the second array containing modifiersIt does shifting left and right, rotation left and right, blink and invert (in 8 steps).Code://#define debug#if defined(debug)#define stepTime 250#else#define stepTime 50#endifint pinArray[] = {2, 3, 4, 5, 6, 7, 8, 9};//copy or paste this into patOgen//from hereconst PROGMEM byte myArray[] = {0xaa, 0x01, 0x80, 0x60, 0x06, 0x55, 0xff};const PROGMEM byte myArrayModifiers[] = {0x05, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06};//to here#define noSteps sizeof(myArray)int currentStep = 0;void setup() {for (int i = 0; i < 8; i++) {pinMode(pinArray, OUTPUT);#if defined(debug)Serial.begin(115200);#endif}}void loop() {static long lightTime = millis();if (millis() - lightTime > stepTime) {static byte myLights = 0;static byte mode = 0;static byte subStep = 0;if (subStep == 0) {myLights = pgm_read_byte_near(myArray + currentStep);mode = pgm_read_byte_near(myArrayModifiers + currentStep);}switch (mode) {case 1://shlif (subStep > 0)myLights <<= 1;break;case 2://shrif (subStep > 0)myLights >>= 1;break;case 3://rolif (subStep > 0)myLights = ((myLights & 0x80) ? 0x01 : 0x00) | (myLights << 1);break;case 4://rorif (subStep > 0)myLights = ((myLights & 0x01) ? 0x80 : 0x00) | (myLights >> 1);break;case 5://invertif (subStep > 0)myLights = ~myLights;break;case 6://blinkif (subStep % 2 == 0)myLights = pgm_read_byte_near(myArray + currentStep);elsemyLights = 0x00;break;default:subStep = 7;break;}subStep++;subStep %= 8;#if defined(debug)Serial.println(subStep);Serial.println(myLights, BIN);Serial.println();#endiffor (int i = 0; i < 8; i++) {digitalWrite(pinArray, (bool)(0x01 & (myLights >> i)));}if (subStep == 0) currentStep++;currentStep %= noSteps;lightTime = millis();}}

author: deejay2k1
author_rank: Newbie
timestamp: December 04, 2016, 11:25:26 am
content: GUI version 1.2 releasedUpdate ver 1.2: Added 8 modifiers for every sequence.no modifier (----) just displays the sequence one (step) time<--- move sequence to left in 8 steps---> move sequence to right in 8 steps<--< rotates sequence to left in 8 steps>--> rotates sequence to right in 8 stepsinvert inverts sequence in 8 stepsblink blink/strobe sequence in 8 steps (4 on, 4 off)<-fill fills sequnce to the left with whatever value in bit b0 in 8 stepsfill-> fills sequnce to the right with whatever value in bit b7 in 8 steps

author: deejay2k1
author_rank: Newbie
timestamp: December 04, 2016, 05:33:03 pm
content: Update ver 1.3: Added multiplier for every sequence (how many times it should repeat itself)Update ver 1.4: Added new modifiers.fill from middle (b4 and b3) outwardsfill from edges (b7 and b0) inwardsexplode (shift from middle outwards)implode (shift from edges inwards)stack (sequence bits are not used, only the modifiers matters)drip (same conditions as stack)That's all folks!