//board STM32F103C9T6 (64Kb**(64Kb you should beliefe but STM building in 128KB and sellers dont tell)** 72Mhz) || tft: ILI9341 (240x320pixel 2,8" COLOR LCD SPI) || testprogramm uses Adafruit library have fun =^.^= marderchen //pins TFT ::VCC on 3.3V ::LED on 3.3V ::GND on GND :: CS on PA9 :: Reset on PA10 :: DC/RS on PB5 :: SCK on A5 :: MISO on A6 :: MOSI on A7 //pins touch T_clk = PB13 | T_cs = PA8 | T_din = MOSI = PB15 | T_D0 = PB13 | T_IRQ = PB12 #include "SPI.h" #include "Adafruit_GFX_AS.h" #include "Adafruit_ILI9341_STM.h" #include "XPT2046_touch.h" #include #define TFT_CS PA9 #define TFT_DC PB5 #define TFT_RST PA10 #define swap(a, b) { int16_t t = a; a = b; b = t; } #define screeny 9 Adafruit_ILI9341_STM tft = Adafruit_ILI9341_STM(TFT_CS, TFT_DC, TFT_RST); // Use hardware SPI #define CS_PIN PA8 // Chip Select pin #define UPDATES_PER_SECOND 5000 //lila tx_>rx SPIClass mySPI(2); //Create an SPI instance on SPI1 port. XPT2046_touch ts(CS_PIN, mySPI); // Chip Select pin, SPI port its not the chip from touchmodule but working fine uint16_t xy[2]; //led #define LED_PIN PB8 #define BRIGHTNESS 255 #define LED_TYPE WS2812 #define COLOR_ORDER GRB CRGB leds[screeny]; CRGBPalette16 currentPalette; TBlendType currentBlending; #define UPDATES_PER_SECOND 5000 extern CRGBPalette16 myRedWhiteBluePalette; #define BLACK 0x0000 #define BLUE 0x001F #define RED 0xF800 #define GREEN 0x07E0 #define DARKGREEN 0x03E0 #define CYAN 0x07FF #define PURPLE 0x780F #define MAGENTA 0xF81F #define YELLOW 0xFFE0 #define WHITE 0xFFFF /// currently my first MSGEQ7 testingidea /// gaphicequalizer on multiplexer reset: A2 multiplexer switch A1 multiplexer hope analog output A0 #define noisereset PA2 #define noiseswitch PA1 #define noise PA0 uint32_t noisedata[16]; long color =0; long colorc =0; int g = 0; int f1 = 0; int ttt[3] ; int ons[4] ; int duty[10] ; int r=0; uint32_t rainbow[129] = {0xff0000,0xff0500,0xff0a00,0xff0f00,0xff1400,0xff1900,0xff1e00,0xff2400,0xff2900,0xff2e00,0xff3300,0xff3800,0xff3d00,0xff4200,0xff4700,0xff4c00,0xff5100,0xff5600,0xff5b00,0xff6100,0xff6600,0xff6b00,0xff7000,0xff7500,0xff7a00,0xff7f00,0xff8400,0xff8900,0xff8e00,0xff9300,0xff9800,0xff9d00,0xffa100,0xffa600,0xffab00,0xffb000,0xffb500,0xffba00,0xffbf00,0xffc400,0xffc900,0xffce00,0xffd300,0xffd800,0xffdd00,0xffe100,0xffe600,0xffeb00,0xfff000,0xfff500,0xfffa00,0xffff00,0xf5ff00,0xebff00,0xe0ff00,0xd6ff00,0xccff00,0xc2ff00,0xb8ff00,0xadff00,0xa3ff00,0x99ff00,0x8fff00,0x85ff00,0x7aff00,0x70ff00,0x66ff00,0x5cff00,0x52ff00,0x47ff00,0x3dff00,0x33ff00,0x29ff00,0x1fff00,0x14ff00,0x0aff00,0x00ff00,0x00ff0a,0x00ff14,0x00ff1d,0x00ff27,0x00ff31,0x00ff3b,0x00ff45,0x00ff4e,0x00ff58,0x00ff62,0x00ff6c,0x00ff76,0x00ff80,0x00ff89,0x00ff93,0x00ff9d,0x00ffa7,0x00ffb1,0x00ffba,0x00ffc4,0x00ffce,0x00ffd8,0x00ffe2,0x00ffeb,0x00fff5,0x00ffff,0x00f5ff,0x00ebff,0x00e0ff,0x00d6ff,0x00ccff,0x00c2ff,0x00b8ff,0x00adff,0x00a3ff,0x0099ff,0x008fff,0x0085ff,0x007aff,0x0070ff,0x0066ff,0x005cff,0x0052ff,0x0047ff,0x003dff,0x0033ff,0x0029ff,0x001fff,0x0014ff,0x000aff,0x0000ff}; int speedso,speedmeld; String cachb=""; String cachc=""; String message=""; int b=0; //------------------- int cachys=0; int bar=0; int onof=0; boolean confed=false; int rainbowcounter =0; long colorcounta1 =0; long colorcounta2 =1000; //ende anizeugs int schneezahl =4096; int schneezahl2 =0; int menge =20; int speedy =0; int achsex =0; int achsey =0; int colorcountv2 =0; int rainycount=0; void setup() { pinMode(noisereset, OUTPUT); pinMode(noiseswitch, OUTPUT); FastLED.addLeds(leds, screeny).setCorrection( TypicalLEDStrip ); FastLED.setBrightness( BRIGHTNESS ); currentPalette = RainbowColors_p; currentBlending = BLEND; delay( 1000 ); tft.begin(); ts.begin(); tft.fillScreen(ILI9341_BLACK); tft.setRotation(3); Serial3.begin(115200); } void loop() { shownoise(); showinfoz(); //zeigmal(); //configwifi(); //wifihappend(); //WS2812rainbow(); } int tspedy =0; int rhc =45; int rwc =210; int blacky =0; int rgbdlm =0; int x10=0; int rgbc=0; long leinmovcolor =0; int wenig=0; //thanks to adafruit for PROGMAN algoritm int rainbowcolor3 =0; void wuselBitmap(int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint32_t colorspeed, int8_t chaos, boolean colormove) { int16_t i, j, byteWidth = (w + 7) / 8; uint8_t byte; for(j=0; j= 128) { rainbowcolor3 =1;} if (colormove == true) {colory(rainbow[rainbowcolor3]); tft.drawPixel(x+i+random(-chaos,chaos),y+i+random(-chaos,chaos), tft.color565(r,g,b));} if (colormove == false) {colory(colorspeed); tft.drawPixel(x+i+random(-chaos,chaos),y+i+random(-chaos,chaos), tft.color565(r,g,b));} } } } void wuselfillrect(int16_t eckex, int16_t eckey,int16_t breit, int16_t hoch,uint32_t colorspeed, int8_t chaos, boolean colormove) { for( int ry = eckex; ry < (hoch); ry++) { wuselline(eckex,eckey+ry,eckex+breit,eckey+ry,colorspeed,chaos,colormove); } } void wuselrect(int16_t eckex, int16_t eckey,int16_t breit, int16_t hoch,uint32_t colorspeed, int8_t chaos, boolean colormove) { wuselline(eckex,eckey,eckex+breit,eckey,colorspeed,chaos,colormove); wuselline(eckex+breit,eckey,eckex+breit,eckey+hoch,colorspeed,chaos,colormove); wuselline(eckex+breit,eckey+hoch,eckex,eckey+hoch,colorspeed,chaos,colormove); wuselline(eckex,eckey+hoch,eckex,eckey,colorspeed,chaos,colormove); } int rainbowcolor =0; int rainbowcolor2 =0; int colorslows=0; int colorslows2=0; //Bresenham's algorithm - thx wikpedia (and adafruit) but the marderchenmod void wuselline(int16_t x0, int16_t y0,int16_t x1, int16_t y1,uint32_t colorspeed, int8_t chaos, boolean colormove) { //if colormove =false, colorspeed = color ( 0xFF205B etc.) int16_t steep = abs(y1 - y0) > abs(x1 - x0); if (steep) {swap(x0, y0);swap(x1, y1);} if (x0 > x1) {swap(x0, x1);swap(y0, y1);} int16_t dx, dy;dx = x1 - x0;dy = abs(y1 - y0); int16_t x10=x0; int16_t err = dx / 2; int16_t err2 = dx / 2;int y10 =y0; int16_t ystep; if (y0 < y1) {ystep = 1;} else {ystep = -1;} for (; x0<=x1; x0++) {colorslows2++; if (colorslows2 >50) {rainbowcolor +=colorspeed; colorslows2=0;} if (rainbowcolor >= (128-colorspeed)) { rainbowcolor =1;} if (steep) { if (colormove == true) { colory(rainbow[rainbowcolor2]); tft.drawPixel(y0, x0, tft.color565(r,g,b));}if (colormove == false) { colory(colorspeed); tft.drawPixel(y0, x0,tft.color565(r,g,b));} } else { if (colormove == true) { colory(rainbow[rainbowcolor2]); tft.drawPixel(x0, y0, tft.color565(r,g,b));}if (colormove == false) { colory(colorspeed); tft.drawPixel(x0, y0, tft.color565(r,g,b));}} err -= dy; if (err < 0) {y0 += ystep;err += dx;}} for (; x10<=x1; x10++) {colorslows++; if (colorslows >50) {rainbowcolor2 +=chaos; colorslows=0;} if (rainbowcolor2 >= (128-chaos)) { rainbowcolor2 =1;} if (steep) {if (colormove == true) {colory(rainbow[rainbowcolor2]); tft.drawPixel(x10+random(-chaos,chaos),y10+random(-chaos,chaos), tft.color565(r,g,b)); } if (colormove == false) { colory(colorspeed); tft.drawPixel(x10+random(-chaos,chaos),y10+random(-chaos,chaos), tft.color565(r,g,b)); } } else { if (colormove == true) {colory(rainbow[rainbowcolor2]); tft.drawPixel(x10+random(-chaos,chaos),y10+random(-chaos,chaos), tft.color565(r,g,b));} if (colormove == false) {colory(colorspeed); tft.drawPixel(x10+random(-chaos,chaos),y10+random(-chaos,chaos),tft.color565(r,g,b));}} err2 -= dy; if (err2 < 0) {y10 += ystep; err2 += dx;}} } int colorw =0; int colorIndex =0; void WS2812rainbow(){ colorw +=1; if (colorw > 500) {colorw=0;} for( int iy = 0; iy < screeny; iy++) { colorIndex+=3; //leds[iy] = rainbow[round(colorw)]; leds[iy] = ColorFromPalette( currentPalette, colorIndex, 255, currentBlending);} } uint16_t colors [] = {0xF800,0xF81F,0x001F,0x07FF,0x07E0,0xFFE0}; int startx =55; int starty=14; int once =0; int c1 =0; void shownoise(void) { // tft.fillScreen(ILI9341_BLACK); hearthenoise(); for(uint8_t drawy =0; drawy < 14; drawy++){ for(uint8_t more =0; more < 10; more++){ colory(rainbow[round((drawy*20+more)*0.4)]); tft.drawFastVLine(drawy*20+more,235,230-(noisedata[drawy]/18),BLACK); tft.drawFastVLine(drawy*20+more,5,(noisedata[drawy]/18),tft.color565(r,g,b)); }}} void showinfoz(void){ rainbowcounter+=5; if (rainbowcounter >128) {rainbowcounter=0;} tft.setCursor(6,6); colory(rainbow[rainbowcounter]); tft.setTextColor(tft.color565(r,g,b)); tft.println("MEOW graphiceuqalizer test"); tft.println("by marderchen =^.^");/* if(ts.read_XY(xy)){ //if before if only should sett on touching.. but don't work have changet tresolt in library but also none real effect // tft.drawRect(ttt[0]-20,ttt[1]-20,40,40,tft.color565(r,g,b)); ttt[0] =320-( xy[1]/11-15); //offset x ttt[1] =240-( xy[0]/15-11); //offset Y }*/ tft.setCursor(0,0); tft.drawRect(0,0,320,6,BLACK); for (uint8_t space=0; space <14; space++) { colory(rainbow[round((space*20)*0.42)]); tft.setTextColor(tft.color565(r,g,b)); tft.print(noisedata[space]); tft.print(" "); } } void colory(uint32_t colorz) { String hexcolor = String(colorz); int number = hexcolor.toInt(); r = number >> 16; g = number >> 8 & 0xFF; b = number & 0xFF; } int speedb=0; String cachb2=""; void configwifi(void){ if ((speedb%2) == 1 && speedb <=10){tft.println("tick");} if ((speedb%2) == 0 && speedb <=10){tft.println("tack");} if (speedso > 50) { if (speedb <13) { speedb++;} if (speedb ==1) { cachb2=""; Serial3.println("AT");} if (speedb ==2) { cachb2=""; Serial3.println("AT+RST"); message = "START wifi conf.";} if (speedb ==3) { cachb2=""; Serial3.println("AT+CWLAP"); } if (speedb ==4) { cachb2=""; Serial3.println("AT+GMR");} if (speedb ==5) { cachb2=""; Serial3.println("AT+CWMODE=3"); message = "LOAD.. meow! ";} if (speedb ==6) { cachb2=""; Serial3.println("AT+CWJAP=\"Acme-Labs2\",\"axruntpv\"");} if (speedb ==7) { cachb2=""; Serial3.println("AT+CIFT"); } if (speedb ==8) { cachb2=""; Serial3.println("AT+CIPMUX=1");message = "purrr Wifi connected ";} if (speedb ==9) { cachb2=""; Serial3.println("AT+CIPSERVER=1,3366"); } if (speedb ==12) { message = "READY... meow "; cachb2=""; Serial3.println("."); int kaaa=0; confed=true;} tft.println(message); speedso=0; }} void wifihappend(void) { cachb =""; cachc =""; while(Serial3.available()>0) {//Serial3.available()>0 && int cachs = Serial3.read(); cachc += (char)cachs; if (cachc.length() >11){cachb += (char)cachs;} //if (isDigit(cachs)) {ram +=(char)cachs; }} }} long maintime=micros(); long maintime2=micros(); long maintime3=micros(); void zeitreise(void){ while ((millis()- maintime) >= 12) { speedso++; speedmeld++; maintime = millis(); } while ((micros()- maintime2) >= 800) { maintime2 = micros();} } void hearthenoise(void){ //>MEOW trying my owen thingi thingi , but its not realy working isn#T IT? it if its usefull :3 digitalWrite(noisereset, HIGH); digitalWrite(noiseswitch,HIGH); digitalWrite(noisereset, LOW); digitalWrite(noiseswitch,LOW); for(uint8_t bar =0; bar <14; bar+=2) { digitalWrite(noiseswitch,LOW); noisedata[bar]= analogRead(noise); } for(uint8_t morebar =1; morebar <14; morebar+=2) { noisedata[morebar]= round((noisedata[morebar-1]+noisedata[morebar+1])/2); } } /* void hearthenoise(void){ //>MEOW trying to use the times from chiptatasheet.. not realy functional cachys=0;bar =0; while(bar < 14){ if (cachys == 0){ digitalWrite(noisereset, HIGH); digitalWrite(noiseswitch,HIGH);} if (cachys == 9){ digitalWrite(noisereset, LOW); if ((cachys%18) == 0){ bar++; if (onof== 0) {digitalWrite(noiseswitch,LOW); noisedata[bar]= analogRead(noise);} if (onof== 1) {digitalWrite(noiseswitch,HIGH); onof=0;} onof++; } while ((micros()- maintime3) >= 2) { cachys++; maintime3 = micros();} }} for(uint8_t morebar =1; morebar <14; morebar+=2) { noisedata[morebar]= round((noisedata[morebar-1]+noisedata[morebar+1])/2); } } /* * MEOW! This is maybe a adafruit based aditional thingi.. have createt it caused the lcd colors are not the rainbow spectrumm. so nor can use uint32_t colors like on PC.. and draw the square line fill thingis direct with chaos and rainbow rainbow colors.. * * by marderchen =^.^= MEOW! its free use it or parts if you want its cute to making world more colorfull * its just a help for me to desing the optical interface for me better so there are thinks like touchscreen and WS2812 also in this programm running on same time * iam not professional! writing this mess is just a cute hobby.. so the most working, somthing is not displayed 100% correct, just fast writedown.. * ( questions : mail to meow@marderchen.de or fisit IRC) * ___ * _.-| | / |\__/,| (`\ { | | -- |^ ^ |__ _) ) "-.|___| \ _.( Y ) ` / .--'-`-. _((_ `^--' /__< \ ....-+|______|__.-||__)`-' (((/ (((/ CATS are awesome! */ /* cattz++; colorcount3 +=20; if (cattz == 1) {tft.drawBitmap(102,50, cat,30, 26, colorcount3);} if (cattz == 2) {tft.drawBitmap(102,50+1, cat2,30, 25, colorcount3);} if (cattz == 3) {tft.drawBitmap(102,50+2, cat3,30, 24, colorcount3);} if (cattz == 4) {tft.drawBitmap(102,50+1, cat2,30, 25, colorcount3);} if (cattz == 5) {cattz = 0;} if (colorcount3 >= 65535) {colorcount3=1;} */ // a 120*WS2812B (screenmatrix) +16x WS2812 (above, lives and waponpower) + 8dig led (score etc..) superbright+colorfull Acardegamingproject //controler: current 2axes console analogjoistig with pushjtaster and 4tasters cros (3Watt RGB in controllerplatine for effects) // i want the glow Atro Commander verry old lcd acarde game but its expensive and never money so build my own (maybe also snake, other games ) in a verry bright vision // the 120 WS2812B have a total factory rated powerconsumtion from 30Watts (purrrr this is even psychedwelic bright if somany) //cutrrent controllertest working fine its calibrated.. now have do martenkode the games i want // fastled lib SmartMatrix function haven worked so find my own system caused its faster to write own than try to get the example working.. //its free use it or parts if something usefull [MEOW] =^.^= //** Serial 3 is connectet to 433Mhz rx/tx RF modules, maybe let pc play the gemesound.. or use serial2 sor serial mp3 player don't know.. // 3gp video from testing this running kote http://marderchen.de/NEU/120xWS2812B_acardematrix_purrgamepadworking+calibrated.3gp // video from rainbowtesting matrix http://marderchen.de/NEU/120xWS2812B_selfbuildacardematrix_rainbowtest.3gp /* * pictures: * http://marderchen.de/NEU/120x_WS2812B_30Watt-ledcolormatrix_gamepad.jpg * http://marderchen.de/NEU/120xWS2812B_matrixtest_5Vunlimited-Ampere_test.jpg * http://marderchen.de/NEU/120x-ws2812B_Matrix10x12_fordrivewith_factoryrated_30watt.jpg for using maximum efficience and brighteness its a mass cooper (NYM 1,5mm˛) wire on read for cooling and optimal power to spread, capacitors for Stabilasing voltage: 6x 1000yF 10V (for 5V) 2x 1000yF in controller for 3v3 and 5v) * http://marderchen.de/NEU/120xWS2812B_matrix_testfine.jpg */ //today get mp3/wav serial mp3player purrrfect functional and batterypowerledbar in controller //video from playerfunction http://marderchen.de/0/WS2812_acartegamematrix_serial_microsdplayercontroll_purrfect.3gp now its macing noise for games just have to create them^^ #include #include #include const byte chips = 1; // 1 chip, bit banged SPI on pins 6, 7, 8 MAX7219 display (chips, PA4, PA7, PA5); // Chips / LOAD / DIN / CLK String mews = "Purrrrrr "; //const char message []= "Start config"; #include #define LED_PIN PB8 //DIN connect to pin B8 #define BRIGHTNESS 255 #define LED_TYPE WS2812B //did you know you can mix WS2812B and WS2812 leds in sane stripe on same databus oh its realy moving cute fast.. like the older WS2812 more causet little more power consumtion, bigger LED chips, (looking brighter caused biger chips) and think it make sense to use the old big chips caused better heataway.. think the smallittlenew ones have just not enought ground contakt foor goot efficient cooling #define COLOR_ORDER GRB #define screeny 145 //number of leds CRGB leds[screeny]; CRGBPalette16 currentPalette; TBlendType currentBlending; #define UPDATES_PER_SECOND 5000 extern CRGBPalette16 myRedWhiteBluePalette; #define rot PA8 #define grun PB15 #define blau PB14 #define t1 PB12 #define t2 PB13 #define t3 PB5 #define t4 PA10 #define t5 PA9 #define achsex PA0 #define achsey PA1 #define power PB1 int mwidth= 12; int mhight=10; int16_t matrix[13][11][3]; long maintime = millis(); int zeit1,zeit2; int xj=0; int yj=0; int8_t onpress[17]; //serial mp3 player thingy oh no i have reead the manuyl.. tthe first ever^^ int8_t commandbuild[8]= {0}; // first command begin byte, second versionbyte, 3. bytelength (without start/endbyte),4. should do byte, 5. want answer=01 else =00, 6 and 7 numbers 00-FF more information what should do).. see how simple it is^^ /* soundschosen:: somday.. win pinpall from 261-309 .. pacman 188-191 * playone(123); move x || playone(134); movey || playone(220); start game || endgegener playone(231); || playone(106); lost game || win game playone(357); * schiez sounds playone(178); playone(5); playone(108); playone(315); playone(228); || shot lazor playone(143); playone(201); * aufschlag gegner sound playone(122); playone(135); * zerstört gegner sounds playone(142); playone(119); playone(73); playone(20); playone(221); playone(177); playone(172); playone(229); * level up playone(242); || lost energy playone(257); || get energy playone(256); || granat playone(309); * loosinglive playone(323); || get live playone(157); playone(18); || error playone(22); || pick up playone(101); playone(43); playone(44); * new enemy playone(117); * caused kitten playone(131); playone(132); playone(133); */ void setup(){ delay(1000); commandbuild[0]=0x7e; commandbuild[1]=0xFF; commandbuild[2]=0x06; commandbuild[4]=0x01; commandbuild[7]=0xEF; display.begin(); Serial3.begin(9600);//RF Serial2.begin(9600);//grun tx mitte rx orange 3v3+++++++++++++ //player FastLED.addLeds(leds, screeny).setCorrection( TypicalLEDStrip ); FastLED.setBrightness( BRIGHTNESS ); currentPalette = RainbowColors_p; currentBlending = BLEND; outputon(true); delay(50); nureinmal(true); } int16_t counts=0; int battvoll=0; int wielaud=0; void loop(){ zeitreise(); clearleds(); joy(); buttons(); matrix[xj][yj][3]=1; regenbogen(); batt(); // scratchdigs(); FastLED.show(); FastLED.delay(1000 / 15000); //realy need this delay? XD } void batt(void) { //think have to adjust more its for get the battery charge over analog meassure from optokopler powered by cellvoltage over resistor.. battvoll=136+round(analogRead(power)/400); for( int bing= 136; bing < 144; bing++) { if (bing >battvoll) {leds[bing]=0x880011;} if (bing <=battvoll) {leds[bing]=ColorFromPalette( currentPalette,random(0,255),255,currentBlending);} } } void joy(void) { //for reading the analog xbox gambap ** pinleft 1 3V3 pin center GPIO analog input pin right GND || joystickpotis and get value with display meassures xj= round((4096-analogRead(achsex))/341); yj= round(analogRead(achsey)/410); } void buttons() { // for reading tasters without clipping multiple count on one press effect if (zeit2 >=1) { if (digitalRead(t1) == HIGH && onpress[0] ==0) { onpress[0] =1; counts++; undlos(String(counts)); playone(counts);} if (onpress[0] == 1) { onpress[1]++; }// leds[121]=ColorFromPalette( currentPalette,onpress[1]*5,255,currentBlending); }//spiel(melodie2); if (onpress[1] >= 10) { onpress[1] =0; onpress[0]=0; } if (digitalRead(t2) == HIGH && onpress[2] ==0) { onpress[2] =1; counts--; undlos(String(counts)); playone(counts);} if (onpress[2] == 1) { onpress[3]++; }// leds[122]=ColorFromPalette( currentPalette,onpress[3]*10,255,currentBlending); } if (onpress[3] >= 10) { onpress[3] =0; onpress[2]=0; } if (digitalRead(t3) == HIGH && onpress[4] ==0) { onpress[4] =1; wielaud++;if (wielaud >=30){wielaud=0;} undlos(String(wielaud)); mux(wielaud); } if (onpress[4] == 1) { onpress[5]++; }// leds[123]=ColorFromPalette( currentPalette,onpress[5]*15,255,currentBlending); } if (onpress[5] >= 10) { onpress[5] =0; onpress[4]=0; } if (digitalRead(t4) == HIGH && onpress[6] ==0) { onpress[6] =1; wielaud--;if (wielaud <=0){wielaud=0;} undlos(String(wielaud)); mux(wielaud);} if (onpress[6] == 1) { onpress[7]++; }// leds[124]=ColorFromPalette( currentPalette,onpress[7]*20,255,currentBlending); } if (onpress[7] >= 10) { onpress[7] =0; onpress[6]=0; } if (digitalRead(t5) == HIGH && onpress[8] ==0) { onpress[8] =1; commandbuild[3]=0x03; commandbuild[5]=0x00; commandbuild[6]=0x00; texteplayerzu();}// playone(counts);} if (onpress[8] == 1) { onpress[9]++; }// leds[125]=ColorFromPalette( currentPalette,onpress[9]*25,255,currentBlending); } if (onpress[9] >= 10) { onpress[9] =0; onpress[8]=0; } zeit2=0; }} void clearleds(void) { for( int xxx= 0; xxx < mwidth; xxx++) { for( int yyy= 0; yyy < mhight; yyy++) {matrix[xxx][yyy][3]=0;}} for( int live= 121; live < 136; live++) { leds[live]=CRGB::Black;} } int zeitk=0; int color2=0; int color=0; int speedz=0; int merkup=0; int positron=0; void regenbogen(void){ // for hurryscurry ma matrixarradata indo the 12x10px WS2812B screen if (merkup==0) {color2++;} // if (merkup==1) {color2--;} if (color2 > 4096) {color2=0; } // if (color2 < 0) {merkup=0;} color=color2; positron=0; for( int xx= 0; xx < mwidth; xx++) { for( int yy= 0; yy < mhight; yy++) { color++; if (matrix[xx][yy][3]==0){ leds[positron]= 0x000000;} if (matrix[xx][yy][3]==1){ leds[positron]= 0xffffff;} if (matrix[xx][yy][3]==2){ leds[positron]= 0xff0000;} if (matrix[xx][yy][3]==3){ leds[positron]= 0xffff00;} if (matrix[xx][yy][3]==4){ leds[positron]= 0x00ff00;} if (matrix[xx][yy][3]==5){ leds[positron]= 0x00ffff;} if (matrix[xx][yy][3]==6){ leds[positron]= 0x0000ff;} if (matrix[xx][yy][3]==7){ leds[positron]= 0xff00ff;} if (matrix[xx][yy][3]==8){ matrix[xx][yy][0]=color; matrix[xx][yy][1]=sin(color/360)*360; leds[positron]=ColorFromPalette( currentPalette,matrix[xx][yy][0], matrix[xx][yy][1],currentBlending);} positron++; }}} int denda,blinkz; void scratchdigs() { mews =""; if(xj <=9) {mews+="0";} if(xj <=99) {mews+="0";} if(xj <=999) {mews+="0";} if(xj <=9999) {mews+="0";} mews += String(xj); if(yj <=9) {mews+="0";} if(yj <=99) {mews+="0";} if(yj <=999) {mews+="0";} if(yj <=9999) {mews+="0";} mews += String(yj); undlos(String(mews)); } void undlos(String meows) { // for print string to MAX 8dig display for (int i = 0; i < 8; i++){ display.sendChar (i, meows[i]); if (i == denda && (blinkz >8)) {display.sendChar (i, ' '); } } } void zeitreise(void){ while ((millis()- maintime) >= 10) { zeit1++; zeit2++; if(zeit1 > zeitk) { speedz++;zeit1=0;} if (speedz > 200) { speedz = 0; zeitk=random(20,50);} maintime = millis(); } } // mp3/wav microsd serial mp3 player stuff uint8_t das0xzeug=0x00; uint8_t mehr0xzeug=0x00; void playone(int16_t dasda){ das0xzeug= (int8_t)(dasda >> 8); mehr0xzeug= (int8_t)(dasda); commandbuild[3]= 0x03; commandbuild[5]= das0xzeug;commandbuild[6]= mehr0xzeug; texteplayerzu(); } void mux(int8_t wielaut){ //wielaut 0-30 das0xzeug= (int8_t)(wielaut); commandbuild[3]= 0x06; commandbuild[5]= 0x00; commandbuild[6]= das0xzeug; texteplayerzu(); } void nureinmal(boolean janein){ if (janein ==true ) {commandbuild[3]= 0x19; commandbuild[5]=0x00; commandbuild[6]=0x00;} if (janein ==false) {commandbuild[3]= 0x19; commandbuild[5]=0x00; commandbuild[6]=0x01;} texteplayerzu(); } void playmitmux(int8_t dasdar, int8_t wielaut){ das0xzeug= (int8_t)dasdar; mehr0xzeug= (int8_t)wielaut; commandbuild[3]= 0x22; commandbuild[5]=mehr0xzeug; commandbuild[6]=das0xzeug; texteplayerzu(); } void texteplayerzu(void){ delay(50); for(uint8_t woo=0; woo<8; woo++){Serial3.write(commandbuild[woo]);} } void outputon(boolean sicher){ if (sicher ==true ) {commandbuild[3]= 0x22; commandbuild[5]=0x00; commandbuild[6]=0x00;} if (sicher ==false) {commandbuild[3]= 0x22; commandbuild[5]=0x00; commandbuild[6]=0x01;} texteplayerzu(); } //end //gamestuff void setfighter(int8_t xwo, int8_t ywo, int8_t colorz,int8_t addons){ if (colorz ==0) { matrix[xwoo-1][ywoo-1][3]=6; matrix[xwoo-1][ywoo][3]=4; matrix[xwoo][ywoo][3]=7; matrix[xwoo-1][ywoo+1][3]=6; }