//2.8" 320x240pc none touchscreen ili9341 + ws2812 + ? 550.000mA oszilator or powervapedriver *arduino ide ** STM32F103C9T6 (128kB flash!) -> 85.072 Bytes (64%) used caused fastledlib //MEOW currently functions testing I/O and components (working) //for switching pin with up to 800kHz !thanks #include "speakerpin.h" #define powerpin PB0 #define mossignalon pinMode(powerpin, OUTPUT) #define mosfets1 digitalWrite(powerpin, HIGH) #define mosfets0 digitalWrite(powerpin, LOW) #define tonpin PB15 #define toninit pinMode(tonpin, OUTPUT) #define ton1 digitalWrite(tonpin, HIGH) #define ton0 digitalWrite(tonpin, LOW) #define lcdback PB1 #define backlight pinMode(lcdback , OUTPUT) #define lcdtry1 digitalWrite(lcdback , HIGH) #define lcdtry0 digitalWrite(lcdback , LOW) //ws2812 #include #define LED_PIN PB8 #define BRIGHTNESS 255 #define LED_TYPE WS2812 #define COLOR_ORDER GRB #define screeny 16 CRGB leds[screeny]; CRGBPalette16 currentPalette; TBlendType currentBlending; #define UPDATES_PER_SECOND 5000 extern CRGBPalette16 myRedWhiteBluePalette; // ili9341 2.8" tft #include "SPI.h" #include "Adafruit_GFX_AS.h" #include "Adafruit_ILI9341_STM.h" #define TFT_CS PB14 #define TFT_DC PB13 #define TFT_RST PA8 #define swap(a, b) { int16_t t = a; a = b; b = t; } Adafruit_ILI9341_STM tft = Adafruit_ILI9341_STM(TFT_CS, TFT_DC, TFT_RST); //temperaturfühler #define tres1 PA3 #define tres2 PA4 #define tres3 PB0 //opptokoplermesser #define opto1 PA0 #define opto2 PA1 #define opto3 PA2 //#define opto3 PA3 //display taster #define t1 PA10 #define t2 PA11 #define t3 PA12 #define t4 PC14 #define t5 PC15 //high power LED/farben NPN trans. #define UV PC13 #define rot PA9 #define grun PB6 #define blau PB10 //vapebutton #define tast PB7 long color =0; long colorc =0; int g = 0; int f1 = 0; 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}; uint32_t grays[5] = {0x000000,0x808080,0xffffff}; int b=0; long tim = millis(); long mosz = millis(); int speedb=0; int speedc=0; int maintime =millis(); int8_t digbright5; int soltemps[2][5]; void setup () { delay(500); pinMode(UV, OUTPUT); pinMode(rot, OUTPUT); pinMode(grun, OUTPUT); pinMode(blau, OUTPUT); pinMode(tast, INPUT); pinMode(t1, INPUT); pinMode(t2, INPUT); pinMode(t3, INPUT); pinMode(t4, INPUT); pinMode(t5, INPUT); mossignalon; toninit; backlight; digitalWrite(mos,LOW); digitalWrite(led,LOW); FastLED.addLeds(leds, screeny).setCorrection( TypicalLEDStrip ); FastLED.setBrightness( BRIGHTNESS ); currentPalette = RainbowColors_p; currentBlending = BLEND; tft.begin(); tft.fillScreen(ILI9341_BLACK); tft.setRotation(2); } int temp1,temp2,zeit1; int status1,status2,soll1,soll2; void loop () { wuselbild(); WS2812rainbow(); istinput(); readmessi(); zeitreise(); // mospower(); } int8_t onpress[17]; void istinput() { if (zeit1 >=1) { if (digitalRead(t1) == HIGH && onpress[8] ==0) { onpress[8] =1; status1++; } if (onpress[8] == 1) { onpress[9]++;} if (onpress[9] >= 10) { onpress[9] =0; onpress[8]=0; } if (digitalRead(t2) == HIGH && onpress[10] ==0) { onpress[10] =1; soll1++;} if (onpress[10] == 1) { onpress[11]++;} if (onpress[11] >= 10) { onpress[11] =0; onpress[10]=0; } /* if (digitalRead(tL3) == HIGH && onpress[12] ==0) { onpress[12] =1; soltemps[0][soll2]+=20; } //zeitc -signal if (onpress[12] == 1) { onpress[13]++;} if (onpress[13] >= 10) { onpress[13] =0; onpress[12]=0; } if (digitalRead(tL4) == HIGH && onpress[14] ==0) { onpress[14] =1; soltemps[0][soll2]-=10;} if (onpress[14] == 1) { onpress[15]++;} if (onpress[15] >= 10) { onpress[15] =0; onpress[14]=0; } */ zeit1=0; if (status1 >=3) {status1=0;} if (status2 >=3) {status2=0;} if (soll1 >=4) {soll1=0;} if (soll2 >=4) {soll2=0;} }} void readmessi(void){ if (temp1 < (analogRead(tres1)/10)) {temp1 +=1;} if (temp1 > (analogRead(tres1)/10)) {temp1-=1;} // if (temp2 < (analogRead(CR)/2)) {temp2+=1;} // if (temp2 > (analogRead(CR)/2)) {temp2-=1;} } int zeitzis[6]; void zeitreise(void){ while ((millis()- maintime) >= 100) { // laam++; zeit1++; speedb++; speedc++; maintime = millis(); }} int slowg=0; void mospower(void) { while (digitalRead(tast) == HIGH) { while ((micros()- mosz) >= 2) { for (int16_t w = 0; w < 500; w++) { if ((w%(temp1+2)) ==0) {mosfets1;} if ((w%(temp1+2)) ==1) {mosfets0;} } mosz= micros(); }}} int ccount1=0; void wuselbild() { tft.fillScreen(ILI9341_BLACK); tft.setCursor(30,20); ccount1++; if (ccount1>128){ccount1=0;} colory(rainbow[ccount1]); tft.setTextSize(5); tft.setTextColor(tft.color565(r,g,b)); if (digitalRead(t1) == HIGH) { tft.println("MEOW"); digitalWrite(rot,HIGH);} else {digitalWrite(rot,LOW);} tft.setCursor(30,80); tft.println(temp1); wuselrect(6,15,200,150,3,5,true); } //my rainbow chaotic drawingstuff void wuselfillrect(int16_t eckex, int16_t eckey,int16_t breit, int16_t hoch,uint8_t colorspeed, int8_t chaos, boolean colormove) { for( int rx = eckex; rx < (eckex+breit); rx++) { wuselline(rx,eckey,rx+breit,eckey+hoch,colorspeed,chaos,colormove); } } void wuselrect(int16_t eckey,int16_t eckex, 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; //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++) { rainbowcolor +=colorspeed; 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++) { rainbowcolor2 +=chaos; if (rainbowcolor2 >= (128-chaos)) { rainbowcolor2 =1;} if (steep) { if (colormove == true) {colory(rainbow[rainbowcolor2]); tft.drawPixel(y10+random(-chaos,chaos),x10+random(-chaos,chaos), tft.color565(r,g,b)); } if (colormove == false) { colory(colorspeed); tft.drawPixel(y10+random(-chaos,chaos),x10+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); } FastLED.show(); FastLED.delay(1000 / 5000); } int startx =50; int starty=14; int once =0; int c1 =0; int8_t menu = 0; int8_t zeitz=0; int dist =45; int infh =80; int colori=0; void wuselRGBrec(int16_t eckex,int16_t eckey,int16_t breit,int16_t hoch) { for( int rx = eckex; rx < (eckex+breit); rx++) { colory(rainbow[round(128-(rx-eckex)*0.58)]); tft.drawFastVLine(rx,eckey,hoch,tft.color565(r,g,b)); } } void colory(uint32_t colorz) { String hexcolor = String(colorz); int number = hexcolor.toInt(); r = number >> 16; g = number >> 8 & 0xFF; b = number & 0xFF; } /* MEOW build power li-po caused 3dal walkingtravel next week and wouldn permanently charge vape * by marderchen =^.^= currently working *ITs free! ( copy parts or use it in any kind if its usefull for you ) * ___ * _.-| | / |\__/,| (`\ { | | -- |^ ^ |__ _) ) "-.|___| \ _.( Y ) ` / .--'-`-. _((_ `^--' /__< \ ....-+|______|__.-||__)`-' (((/ (((/ CATS are awesome! */